Skip to content

Instantly share code, notes, and snippets.

@Zmetser
Last active October 25, 2019 09:34
Show Gist options
  • Save Zmetser/3dd5f2f23cd452253e7966b4f2a6f80c to your computer and use it in GitHub Desktop.
Save Zmetser/3dd5f2f23cd452253e7966b4f2a6f80c to your computer and use it in GitHub Desktop.
/* @flow */
type Slide = {| id: number |}
class Test {
slidesWithAds: Array<Slide> = [{id: 2}];
getNonAdSlideIndex(indexWithAds: number): ?Slide {
return this.slidesWithAds[indexWithAds];
}
}
const test = new Test();
const slide = test.getNonAdSlideIndex(0);
slide.id // < Cannot get `slide.id` because property `id` is missing in null or undefined [1].
// https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoALgTwA4FMwDKMAlgCb4C8YA3gD5hkBcYAdgK4C2ARrgE5i0AvqgDGMAIYBnSWAAquSehqoAkJJLlJAdWLoAFgEFSk5gd69xmADxEyuAHxgqAbWpMwAJkEAaGu4AsggC6ANyqAOa46ABycCxGtuQAkizkAB4AFMSpuGk6+kYmrJw8vACUzAD8ifjUqGANDSq8UWy8LGD6xJIAdOp22rqGxs7Z6fnDkqFg9Y3CwqiicYqdCkpULLhI8ooZZWEiy0r95E6rij2RMXEJGrgp6Rn++6gnuD1kQA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment