mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Added 'set-value'.
This commit is contained in:
parent
423ace8fe7
commit
afa07abdbb
23
types/set-value/index.d.ts
vendored
Normal file
23
types/set-value/index.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
// Type definitions for set-value 2.0
|
||||
// Project: https://github.com/jonschlinkert/set-value
|
||||
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
export = set;
|
||||
|
||||
// Technically, everything will fall to the last overload,
|
||||
// but the first one can be useful for signature help.
|
||||
|
||||
/**
|
||||
* @param object The object to set `value` on
|
||||
* @param prop The property to set.
|
||||
* @param value The value to set on `object[prop]`
|
||||
*/
|
||||
declare function set<T, K extends keyof T>(object: T, prop: K, value: T[K]): void;
|
||||
/**
|
||||
* @param object The object to set `value` on
|
||||
* @param prop The property to set. Dot-notation may be used.
|
||||
* @param value The value to set on `object[prop]`
|
||||
*/
|
||||
declare function set(object: object, prop: string, value: any): void;
|
||||
12
types/set-value/set-value-tests.ts
Normal file
12
types/set-value/set-value-tests.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import set = require("set-value");
|
||||
|
||||
{
|
||||
const obj = {};
|
||||
set(obj, "a.b.c", "d");
|
||||
set({}, "a\\.b.c", "d");
|
||||
}
|
||||
|
||||
{
|
||||
const obj = { a: 100 };
|
||||
set(obj, "a", 1000);
|
||||
}
|
||||
23
types/set-value/tsconfig.json
Normal file
23
types/set-value/tsconfig.json
Normal 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",
|
||||
"set-value-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/set-value/tslint.json
Normal file
1
types/set-value/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user