Merge pull request #31829 from BenLorantfy/master

[raf] Add types for raf
This commit is contained in:
Sheetal Nandi
2019-01-02 19:13:02 -08:00
committed by GitHub
4 changed files with 49 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for raf 3.4
// Project: https://github.com/chrisdickinson/raf#readme
// Definitions by: Ben Lorantfy <https://github.com/BenLorantfy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare const raf: {
(callback: (timestamp: number) => void): number;
cancel: (handle: number) => void;
polyfill: (globalObject?: any) => void;
};
export = raf;
+11
View File
@@ -0,0 +1,11 @@
import * as raf from "raf";
const handle = raf((timestamp) => {
timestamp; // $ExpectType number
});
handle; // $ExpectType number
raf.cancel(handle);
raf.polyfill();
raf.polyfill({});
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"raf-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}