Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Model JSON value type properly #226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

1 participant