DefinitelyTyped/types/react-native-rss-parser/react-native-rss-parser-tests.ts
Emiliano Leite 48efbe5458 Create types for react-native-rss-parser (#38960)
* feat(@types/react-native-rss-parser): Create types

* feat(@types/react-native-rss-parser): Add itunes prop
2019-10-08 17:08:51 -07:00

19 lines
552 B
TypeScript

import { parse } from 'react-native-rss-parser';
// -- Globals --
declare const fetch: (url: string) => Promise<any>;
declare const console: any;
fetch('http://rss-url.com')
.then(response => response.text())
.then(parse)
.then(feed => {
feed.authors[0].name; // $ExpectError
feed.image.title.toUpperCase(); // $ExpectType string
feed.image.height.toUpperCase(); // $ExpectError
feed.items[0].id; // $ExpectType string
feed.items[0].authors.name; // $ExpectError
})
.catch(console.error);