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

TypeScript Read-List #13

Open
shhider opened this issue Jul 18, 2023 · 3 comments
Open

TypeScript Read-List #13

shhider opened this issue Jul 18, 2023 · 3 comments

Comments

@shhider
Copy link
Owner

shhider commented Jul 18, 2023

👇 See the list below

@shhider
Copy link
Owner Author

shhider commented Jul 18, 2023

TypeScript & Set Theory

Making sense of TypeScript using set theory

type = { aa: string } 不是指一个「有且仅有 aa 属性的 object」,而是所有「有 aa 属性的值」。因此:

  • {}指代除了 nullundefined 的其它所有值,因为这是指「有属性可访问的值」,而 JS 中只有 nullundefined 没有任何属性;
  • { aa: string } & { bb: string } 取前后两者并集,即「有 aa 属性」且「有 bb 属性」;

More

@shhider shhider changed the title TypeScript And Set Theory TypeScript Read-List Jul 18, 2023
@shhider
Copy link
Owner Author

shhider commented Jul 18, 2023

Interface & Type Alias

Differences Between Type Aliases and Interfaces - TypeScript Documentation

the key distinction is that a type cannot be re-opened to add new properties vs an interface which is always extendable.

More

@shhider
Copy link
Owner Author

shhider commented Sep 11, 2023

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

No branches or pull requests

1 participant