Skip to content

Instantly share code, notes, and snippets.

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