Merge pull request #26546 from wessberg/master

Added type definitions for workbox-sw
This commit is contained in:
Nathan Shively-Sanders
2018-06-20 10:08:06 -07:00
committed by GitHub
4 changed files with 1473 additions and 0 deletions

1424
types/workbox-sw/index.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
{
"files": [
"index.d.ts",
"workbox-sw-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"lib": [
"es2015",
"dom",
"webworker"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@@ -0,0 +1,12 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-redundant-jsdoc-2": false,
"no-unnecessary-class": false,
"no-empty-interface": false,
"array-type": false,
"interface-name": false,
"space-before-function-paren": false
}
}

View File

@@ -0,0 +1,11 @@
import WorkboxSW from "workbox-sw";
// $ExpectError
WorkboxSW.core.setLogLevel(5); // $ExpectType void
WorkboxSW.routing.registerRoute("/", WorkboxSW.strategies.networkFirst()); // $ExpectType Route
// $ExpectError
WorkboxSW.precaching.precacheAndRoute(/foo/);
WorkboxSW.precaching.precacheAndRoute(["some-resource.js"], {directoryIndex: "/"}); // $ExpectType void