add types for oembed-parser (#30633)

This commit is contained in:
Dimitri Benin
2018-11-18 11:08:12 -08:00
committed by Pranav Senthilnathan
parent fc8b7956f9
commit 4b2af06acd
4 changed files with 49 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for oembed-parser 1.2
// Project: https://www.npmjs.com/package/oembed-parser
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function extract(url: string): Promise<OembedData>;
export function hasProvider(url: string): boolean;
export interface OembedData {
type: string;
version: string;
html: string;
provider_url: string;
provider_name: string;
}
@@ -0,0 +1,9 @@
import { extract, hasProvider, OembedData } from "oembed-parser";
const url = "https://www.youtube.com/watch?v=8jPQjjsBbIc";
extract(url).then(data => {
const parsedData: OembedData = data;
});
const providerExists: boolean = hasProvider(url);
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"oembed-parser-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }