Skip to content

Instantly share code, notes, and snippets.

@EcutDavid
Last active August 27, 2017 06:01
Show Gist options
  • Save EcutDavid/0cd046b18d01feb1f0fef063cc16e939 to your computer and use it in GitHub Desktop.
Save EcutDavid/0cd046b18d01feb1f0fef063cc16e939 to your computer and use it in GitHub Desktop.
Flappy bird
const optionsInPlainJS = [{
// Oooops
local: 'EN',
index: 1
}, {
locale: 'JP',
index: 2
}, {
locale: 'CH',
index: 3
}];
type Option = {
locale: string;
index: number;
}
const options: Option[] = [{
locale: 'EN',
index: 1
}, {
// TS will yield an error here
local: 'JP',
index: 2
}, {
locale: 'CH',
index: 3
},];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment