mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
feat: add remotedev-serialize types (#34063)
This commit is contained in:
parent
2fa6645d81
commit
55ebcedca6
44
types/remotedev-serialize/index.d.ts
vendored
Normal file
44
types/remotedev-serialize/index.d.ts
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
// Type definitions for remotedev-serialize 1.0
|
||||
// Project: https://github.com/zalmoxisus/remotedev-serialize/
|
||||
// Definitions by: Julian Hundeloh <https://github.com/jaulz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import * as Immutable from 'immutable';
|
||||
|
||||
export type Options = Record<string, boolean>;
|
||||
|
||||
export type Refs = Record<string, any>;
|
||||
|
||||
export type DefaultReplacer = (key: string, value: any) => any;
|
||||
|
||||
export type Replacer = (
|
||||
key: string,
|
||||
value: any,
|
||||
replacer: DefaultReplacer
|
||||
) => any;
|
||||
|
||||
export type DefaultReviver = (key: string, value: any) => any;
|
||||
|
||||
export type Reviver = (key: string, value: any, reviver: DefaultReviver) => any;
|
||||
|
||||
export function immutable(
|
||||
immutable: typeof Immutable,
|
||||
refs?: Refs,
|
||||
customReplacer?: Replacer,
|
||||
customReviver?: Reviver
|
||||
): {
|
||||
stringify: (input: any) => string;
|
||||
parse: (input: string) => any;
|
||||
serialize: (
|
||||
immutable: typeof Immutable,
|
||||
refs?: Refs,
|
||||
customReplacer?: Replacer,
|
||||
customReviver?: Reviver
|
||||
) => {
|
||||
replacer: Replacer;
|
||||
reviver: Reviver;
|
||||
options: Options;
|
||||
};
|
||||
};
|
||||
6
types/remotedev-serialize/package.json
Normal file
6
types/remotedev-serialize/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"immutable": "^3.8.1"
|
||||
}
|
||||
}
|
||||
8
types/remotedev-serialize/remotedev-serialize-tests.ts
Normal file
8
types/remotedev-serialize/remotedev-serialize-tests.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import * as Immutable from 'immutable';
|
||||
import * as Serialize from 'remotedev-serialize';
|
||||
|
||||
const { stringify, parse } = Serialize.immutable(Immutable);
|
||||
|
||||
const data = Immutable.fromJS({foo: 'bar', baz: {qux: 42}});
|
||||
const serialized = stringify(data);
|
||||
const parsed = parse(serialized);
|
||||
23
types/remotedev-serialize/tsconfig.json
Normal file
23
types/remotedev-serialize/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",
|
||||
"remotedev-serialize-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/remotedev-serialize/tslint.json
Normal file
1
types/remotedev-serialize/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user