We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
PrimaryData
null
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
The JSON:API spec says:
Primary data MUST be either: a single resource object, a single resource identifier object, or null, for requests that target single resources an array of resource objects, an array of resource identifier objects, or an empty array ([]), for requests that target resource collections
Primary data MUST be either:
Note "or null" in the first condition.
So the following code should typecheck:
export const doc: JSONAPI.Document = { data: null };
Instead, it gives the following error:
Type 'null' is not assignable to type 'PrimaryData<string, AttributesObject<{ [k: string]: Value; }>>'. [2322]
This is because the PrimaryData type, which is used as the type of data in DocWithData is an interface that assumes the value is an existing object.
data
DocWithData
Is this intentional?
Expected behavior The above should typecheck, but it gives the indicated error.
System Information (please complete the following information):
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The JSON:API spec says:
Note "or
null
" in the first condition.So the following code should typecheck:
Instead, it gives the following error:
This is because the
PrimaryData
type, which is used as the type ofdata
inDocWithData
is an interface that assumes the value is an existing object.Is this intentional?
Expected behavior
The above should typecheck, but it gives the indicated error.
System Information (please complete the following information):
The text was updated successfully, but these errors were encountered: