Skip to content

Instantly share code, notes, and snippets.

@mu-hun
Created January 24, 2023 06:21
Show Gist options
  • Save mu-hun/744f13787ec15537163d388b13cd8ad3 to your computer and use it in GitHub Desktop.
Save mu-hun/744f13787ec15537163d388b13cd8ad3 to your computer and use it in GitHub Desktop.
First item is constant
type A = ['-', ...number[]]
let a = ['-', 1, 2, 3, 4] satisfies A
// You can type check in playground:
// https://www.typescriptlang.org/play?#code/C4TwDgpgBAglC8UDaByAtCgNFAdHgdgK4C2ARhAE5IC61AUHQDYTBQCGCy6WUAjNgCZsAZmwAWalADObYAEspAMzkQpsOkA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment