mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #31213 from BendingBender/on-change
Add types for on-change
This commit is contained in:
Vendored
+9
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user