diff --git a/types/known/index.d.ts b/types/known/index.d.ts new file mode 100644 index 0000000000..1ac8005894 --- /dev/null +++ b/types/known/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for known 2.0 +// Project: https://github.com/sindresorhus/known#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export = known; + +declare function known(object: T): T; diff --git a/types/known/known-tests.ts b/types/known/known-tests.ts new file mode 100644 index 0000000000..f07d8ec577 --- /dev/null +++ b/types/known/known-tests.ts @@ -0,0 +1,8 @@ +import known = require('known'); + +const obj = { foo: true }; + +const obj2 = known(obj); + +obj2.foo; +obj2.bar; // $ExpectError diff --git a/types/known/tsconfig.json b/types/known/tsconfig.json new file mode 100644 index 0000000000..8c29c6b462 --- /dev/null +++ b/types/known/tsconfig.json @@ -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" + ] +} diff --git a/types/known/tslint.json b/types/known/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/known/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }