Merge pull request #31213 from BendingBender/on-change

Add types for on-change
This commit is contained in:
Nathan Shively-Sanders
2018-12-17 15:25:04 -08:00
committed by GitHub
4 changed files with 50 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for on-change 0.1
// Project: https://github.com/sindresorhus/on-change#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export = onChange;
declare function onChange<T extends object>(object: T, onChange: () => void): T;
+17
View File
@@ -0,0 +1,17 @@
import onChange = require('on-change');
const object = {
foo: false,
a: {
b: [
{
c: false,
},
],
},
};
const watchedObject = onChange(object, () => {});
watchedObject.foo = true;
watchedObject.a.b[0].c = true;
+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",
"on-change-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }