Add types for known

This commit is contained in:
Dimitri Benin
2018-12-10 02:22:43 +01:00
parent e95e11dcf2
commit e57e2bfad6
4 changed files with 41 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for known 2.0
// Project: https://github.com/sindresorhus/known#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export = known;
declare function known<T extends object>(object: T): T;
+8
View File
@@ -0,0 +1,8 @@
import known = require('known');
const obj = { foo: true };
const obj2 = known(obj);
obj2.foo;
obj2.bar; // $ExpectError
+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",
"known-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }