Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

精读《MinusOne, PickByType, StartsWith...》 #430

Closed
ascoders opened this issue Jul 9, 2022 · 2 comments
Closed

精读《MinusOne, PickByType, StartsWith...》 #430

ascoders opened this issue Jul 9, 2022 · 2 comments

Comments

@ascoders
Copy link
Owner

ascoders commented Jul 9, 2022

精读 type-challenges Medium 33~40 题。


精读《MinusOne, PickByType, StartsWith...》

@waitingsong
Copy link

waitingsong commented Jul 11, 2022

这儿顺序反了

把对象从不可写变成可写:

type Readonly<T> = {
  readonly [K in keyof T]: T[K]
}

从可写改成不可写也简单,主要看你是否记住了这个语法:-readonly:

// 本题答案
type Mutable<T extends object> = {
  -readonly [K in keyof T]: T[K]
}

@ascoders
Copy link
Owner Author

感谢指正,已更正

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants