mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Fix @types/slate Data type definition to extend Immutable.Map, not Immutable.Record (#38772)
This commit is contained in:
parent
24472452e4
commit
dc72e8ed3b
11
types/slate/index.d.ts
vendored
11
types/slate/index.d.ts
vendored
@ -12,17 +12,18 @@
|
||||
// Benjamin Evenson <https://github.com/benjiro>
|
||||
// Han Jeon <https://github.com/hanstar17>
|
||||
// Kay Delaney <https://github.com/kaydelaney>
|
||||
// Yuichiro Tsuchiya <https://github.com/tuttieee>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
import * as Immutable from "immutable";
|
||||
import { SyntheticEvent } from "react";
|
||||
|
||||
export class Data extends Immutable.Record({}) {
|
||||
[key: string]: any;
|
||||
export interface Data extends Immutable.Map<any, any> {}
|
||||
|
||||
static create(properties: Immutable.Map<string, any> | { [key: string]: any }): Data;
|
||||
static fromJSON(object: { [key: string]: any }): Data;
|
||||
static fromJS(object: { [key: string]: any }): Data;
|
||||
export namespace Data {
|
||||
function create(properties: Immutable.Map<string, any> | { [key: string]: any }): Data;
|
||||
function fromJSON(object: { [key: string]: any }): Data;
|
||||
function fromJS(object: { [key: string]: any }): Data;
|
||||
}
|
||||
|
||||
export interface RulesByNodeType {
|
||||
|
||||
@ -22,6 +22,13 @@ import {
|
||||
import { List } from "immutable";
|
||||
|
||||
const data = Data.create({ foo: "bar " });
|
||||
|
||||
// $ExpectType any
|
||||
data.get('hoge');
|
||||
|
||||
// $ExpectError
|
||||
data['foo'];
|
||||
|
||||
const value = Value.create({ data });
|
||||
|
||||
const node: BlockJSON = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user