我将从sequelize 5.xx升级到6.xx 在sequelize v5中一切正常,但是当我升级时,当我想使用包含中的对象时,通过关联生成的所有属性都会出现打字稿错误。我还尝试了https://sequelize.org/master/manual/typescript.html中的示例,但没有成功。
我希望任何人都可以帮助我!
模型: Participant.js
import { Model, DataTypes } from 'sequelize';
import { STATUS } from '@bb/shared-core/dist/constants/participant';
import sequelize from '@bb/db';
import User from '@bb/components/erp/v1/modules/users/models/User';
import OrderItem from '@bb/components/ecommerce/v2/modules/orders/models/OrderItem';
import Contact from '@bb/components/erp/v1/modules/contacts/models/Contact';
import { DeserializedModel } from '../interfaces/Participant';
export class Participant extends Model implements DeserializedModel {
id!: number;
fkUser: number;
fkOrderItem: number;
fkContact: number;
adminNotes: string;
trainerNotes: string;
attendance: string;
status: string;
readonly createdAt: Date;
readonly updatedAt: Date;
}
Participant.init({
fkUser: {
type: DataTypes.NUMBER, …
Run Code Online (Sandbox Code Playgroud) 我正在使用 SwiftUI 为 iOS、iPadOS 和 macOS 构建应用程序,我需要一个具有透明背景的 TextEditor。
之前有人问过这个问题,我在 iOS/iPadOS(在 SwiftUI 中更改 TextEditor 的背景颜色)找到了一个很好的答案,但对于 macOS 没有。
这是我基于上面链接的代码,非常适用于 iOS 和 iPadOS:
TextEditor(text: $text)
.foregroundColor(.black)
.onAppear {
#if os(macOS)
// ??
#else
UITextView.appearance().backgroundColor = .clear
#endif
}
Run Code Online (Sandbox Code Playgroud)
NSTextView
似乎没有相当于UITextView.appearance()
,所以我不完全确定在那里做什么。
使用.background(Color.clear)
也不起作用:
TextEditor(text: $text)
.foregroundColor(.black)
.background(Color.clear)
.onAppear {
#if os(macOS)
// ??
#else
UITextView.appearance().backgroundColor = .clear
#endif
}
Run Code Online (Sandbox Code Playgroud)
有谁知道在 macOS 上为 TextEditor 获取透明背景的方法?
此外,这里已经专门针对 macOS 询问了这个问题:Changing TextEditor background color in SwiftUI for macOS,但没有给出有效的答案。
javascript ×1
macos ×1
node.js ×1
nstextview ×1
sequelize.js ×1
swift ×1
swiftui ×1
typescript ×1