Skip to content

Instantly share code, notes, and snippets.

@xl1
Last active May 17, 2020 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xl1/764c819860bcc3facdd2b558e63e07c0 to your computer and use it in GitHub Desktop.
Save xl1/764c819860bcc3facdd2b558e63e07c0 to your computer and use it in GitHub Desktop.
TypeScript で再帰的な type が定義できる条件がわからない
// OK
type T = {
[key: string]: T
}
// OK
type U = {
foo: U
} & (() => string)
// Type alias 'V' circularly references itself.
type V = {
[key: string]: V
} & (() => string)
// OK
type W = {
[key: string]: WInterface
} & (() => string)
interface WInterface extends W {}
@xl1
Copy link
Author

xl1 commented May 17, 2020

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