Skip to content

What would be the best way to deal with inject-field warning in this case? (example inside) #2722

Closed Answered by tomlau10
tomlau10 asked this question in Q&A
Discussion options

You must be logged in to vote

不是太明白,繼承哪個基類? dbData嗎?

  • 實際上 dbData object 的字段名,跟要 set 到 pc 上的,並非一一對應 😕
    就是不能說直接做 ---@class Pc: PcDbData
  • 並且如果有1個 PcDbData base class
    不就需要手動對 PcDbData---@field 了?
    這個有點像我最初提到的 method 2 所引伸出的問題

我是想做到一了百了,自動 infer 出新字段
而不需要每次加新字段,就得手動加1個 ---@field

暫時來說可能是用 method 3 🤔

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@tomlau10
Comment options

@MillhioreBT
Comment options

@MillhioreBT
Comment options

@tomlau10
Comment options

Comment options

You must be logged in to vote
1 reply
@tomlau10
Comment options

Answer selected by tomlau10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants