Skip to content

Conversation

@mike-north
Copy link
Member

@mike-north mike-north commented Jan 11, 2018

The current ambient type definitions are inappropriately constrained here

export type ResponseData = [number, { [k: string]: string }, string];

This would not allow for arrays, or non-string values.

I've made a package containing a "JSON value" type defined as

export type Primitive = string | number | boolean | null;
export interface Object {
	[member: string]: Value;
}
export interface Arr extends Array<Value> {}

export type Value = Primitive | Object | Arr;

that models characteristics of JSON values correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant