mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-29 00:51:29 +08:00
* Support Partial<> on setState now that TS 2.1 is out * Update readme to reflect setState being typed correctly * Switch setState to Pick * Restore cloneELement portion of readme * Use Pick<> | S for setState due to cast issue * state and props should be readonly * Fix nit + document why we * Add typescript compiler header * Update to properly order headers * Update readme to reflect 2.1.5 fixing stPick * Update readme now that 2.1.5 is out * All that depend on react now require 2.1 * Fix definition that fails due to readonly state
30 lines
955 B
TypeScript
30 lines
955 B
TypeScript
// Type definitions for React (react-addons-linked-state-mixin) 0.14
|
|
// Project: http://facebook.github.io/react/
|
|
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.1
|
|
|
|
import { Mixin } from 'react';
|
|
|
|
declare var LinkedStateMixin: LinkedStateMixin.LinkedStateMixin;
|
|
type LinkedStateMixin = LinkedStateMixin.LinkedStateMixin;
|
|
export = LinkedStateMixin;
|
|
|
|
declare namespace LinkedStateMixin {
|
|
export interface ReactLink<T> {
|
|
value: T;
|
|
requestChange(newValue: T): void;
|
|
}
|
|
|
|
export interface LinkedStateMixin extends Mixin<any, any> {
|
|
linkState<T>(key: string): ReactLink<T>;
|
|
}
|
|
}
|
|
|
|
declare module 'react' {
|
|
interface HTMLAttributes<T> {
|
|
checkedLink?: LinkedStateMixin.ReactLink<boolean>;
|
|
valueLink?: LinkedStateMixin.ReactLink<boolean | string | number>;
|
|
}
|
|
}
|