mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
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
This commit is contained in:
parent
6b1b1e6d9b
commit
48efbe5458
83
types/react-native-rss-parser/index.d.ts
vendored
Normal file
83
types/react-native-rss-parser/index.d.ts
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
// Type definitions for react-native-rss-parser 1.4
|
||||
// Project: https://github.com/jameslawler/react-native-rss-parser
|
||||
// Definitions by: Emiliano Leite <https://github.com/emilianoLeite>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.3
|
||||
|
||||
export { };
|
||||
|
||||
type Maybe<T> = T | undefined;
|
||||
|
||||
export interface FeedItem {
|
||||
id: string;
|
||||
title: string;
|
||||
links: Array<{
|
||||
url: string;
|
||||
rel: string;
|
||||
}>;
|
||||
description: string;
|
||||
content: string;
|
||||
authors: Array<Maybe<{ name: string }>>;
|
||||
categories: Array<Maybe<{ name: string }>>;
|
||||
published: string;
|
||||
enclosures: Array<{
|
||||
url: string;
|
||||
length: string;
|
||||
mimeType: string;
|
||||
}>;
|
||||
itunes: {
|
||||
authors: Maybe<Array<{ name: string }>>;
|
||||
block: Maybe<string>;
|
||||
duration: string;
|
||||
explicit: string;
|
||||
image: Maybe<string>;
|
||||
isClosedCaptioned: Maybe<string>;
|
||||
order: Maybe<string>;
|
||||
subtitle: string;
|
||||
summary: Maybe<string>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Feed {
|
||||
type: string;
|
||||
title: string;
|
||||
links: Array<{
|
||||
url: string;
|
||||
rel: string;
|
||||
}>;
|
||||
description: string;
|
||||
language: string;
|
||||
copyright: Maybe<string>;
|
||||
authors: Array<Maybe<{ name: string }>>;
|
||||
lastUpdated: string;
|
||||
lastPublished: string;
|
||||
categories: Array<Maybe<{ name: string }>>;
|
||||
image: {
|
||||
title: string;
|
||||
description: Maybe<string>;
|
||||
url: string;
|
||||
height: Maybe<string>;
|
||||
width: Maybe<string>;
|
||||
};
|
||||
itunes: {
|
||||
authors: Array<{ name: string }>;
|
||||
block: Maybe<string>;
|
||||
categories: Array<{
|
||||
name: string;
|
||||
subCategories: Array<Maybe<{ name: string }>>;
|
||||
}>;
|
||||
complete: Maybe<string>;
|
||||
explicit: string;
|
||||
image: string;
|
||||
newFeedUrl: Maybe<string>;
|
||||
owner: {
|
||||
name: string;
|
||||
email: string;
|
||||
};
|
||||
subtitle: Maybe<string>;
|
||||
summary: string;
|
||||
};
|
||||
items: FeedItem[];
|
||||
}
|
||||
|
||||
export function parse(feedUrl: string): Promise<Feed>;
|
||||
@ -0,0 +1,18 @@
|
||||
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);
|
||||
23
types/react-native-rss-parser/tsconfig.json
Normal file
23
types/react-native-rss-parser/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-rss-parser-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/react-native-rss-parser/tslint.json
Normal file
1
types/react-native-rss-parser/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user