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

Simplify TypeScript types in wordpress/core-data #43515

Merged
merged 6 commits into from Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
116 changes: 58 additions & 58 deletions docs/reference-guides/data/data-core.md
Expand Up @@ -21,7 +21,7 @@ _Parameters_
- _state_ `State`: Data state.
- _action_ `string`: Action to check. One of: 'create', 'read', 'update', 'delete'.
- _resource_ `string`: REST resource to check, e.g. 'media' or 'posts'.
- _id_ `GenericRecordKey`: Optional ID of the rest resource to check.
- _id_ `EntityRecordKey`: Optional ID of the rest resource to check.

_Returns_

Expand All @@ -39,9 +39,9 @@ Calling this may trigger an OPTIONS request to the REST API via the
_Parameters_

- _state_ `State`: Data state.
- _kind_ `Kind`: Entity kind.
- _name_ `Name`: Entity name.
- _recordId_ `GenericRecordKey`: Record's id.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _recordId_ `EntityRecordKey`: Record's id.

_Returns_

Expand All @@ -56,11 +56,11 @@ Returns all available authors.
_Parameters_

- _state_ `State`: Data state.
- _query_ `EntityQuery< any >`: Optional object of query parameters to include with request.
- _query_ `EntityQuery`: Optional object of query parameters to include with request.

_Returns_

- `User< 'edit' >[]`: Authors list.
- `User[]`: Authors list.

### getAutosave

Expand All @@ -70,8 +70,8 @@ _Parameters_

- _state_ `State`: State tree.
- _postType_ `string`: The type of the parent post.
- _postId_ `GenericRecordKey`: The id of the parent post.
- _authorId_ `GenericRecordKey`: The id of the author.
- _postId_ `EntityRecordKey`: The id of the parent post.
- _authorId_ `EntityRecordKey`: The id of the author.

_Returns_

Expand All @@ -88,7 +88,7 @@ _Parameters_

- _state_ `State`: State tree.
- _postType_ `string`: The type of the parent post.
- _postId_ `GenericRecordKey`: The id of the parent post.
- _postId_ `EntityRecordKey`: The id of the parent post.

_Returns_

Expand Down Expand Up @@ -149,9 +149,9 @@ Returns the specified entity record, merged with its edits.
_Parameters_

- _state_ `State`: State tree.
- _kind_ `K`: Entity kind.
- _name_ `N`: Entity name.
- _recordId_ `KeyOf< K, N >`: Record ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _recordId_ `EntityRecordKey`: Record ID.

_Returns_

Expand Down Expand Up @@ -179,7 +179,7 @@ Returns the loaded entities for the given kind.
_Parameters_

- _state_ `State`: Data state.
- _kind_ `Kind`: Entity kind.
- _kind_ `string`: Entity kind.

_Returns_

Expand All @@ -192,7 +192,7 @@ Returns the loaded entities for the given kind.
_Parameters_

- _state_ `State`: Data state.
- _kind_ `Kind`: Entity kind.
- _kind_ `string`: Entity kind.

_Returns_

Expand All @@ -207,8 +207,8 @@ Returns the entity config given its kind and name.
_Parameters_

- _state_ `State`: Data state.
- _kind_ `Kind`: Entity kind.
- _name_ `Name`: Entity name.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.

_Returns_

Expand All @@ -221,8 +221,8 @@ Returns the entity config given its kind and name.
_Parameters_

- _state_ `State`: Data state.
- _kind_ `Kind`: Entity kind.
- _name_ `Name`: Entity name.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.

_Returns_

Expand All @@ -237,14 +237,14 @@ entity object if it exists and is received.
_Parameters_

- _state_ `State`: State tree
- _kind_ `K`: Entity kind.
- _name_ `N`: Entity name.
- _key_ `KeyOf< R >`: Record's key
- _query_ Optional query. If requesting specific fields, fields must always include the ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _key_ `EntityRecordKey`: Record's key
- _query_ `EntityQuery`: Optional query. If requesting specific fields, fields must always include the ID.

_Returns_

- Record.
- `EntityRecord | undefined`: Record.

### getEntityRecordEdits

Expand All @@ -253,9 +253,9 @@ Returns the specified entity record's edits.
_Parameters_

- _state_ `State`: State tree.
- _kind_ `K`: Entity kind.
- _name_ `N`: Entity name.
- _recordId_ `KeyOf< K, N >`: Record ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _recordId_ `EntityRecordKey`: Record ID.

_Returns_

Expand All @@ -272,9 +272,9 @@ They are defined in the entity's config.
_Parameters_

- _state_ `State`: State tree.
- _kind_ `K`: Entity kind.
- _name_ `N`: Entity name.
- _recordId_ `KeyOf< K, N >`: Record ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _recordId_ `EntityRecordKey`: Record ID.

_Returns_

Expand All @@ -287,13 +287,13 @@ Returns the Entity's records.
_Parameters_

- _state_ `State`: State tree
- _kind_ `K`: Entity kind.
- _name_ `N`: Entity name.
- _query_ Optional terms query. If requesting specific fields, fields must always include the ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _query_ `EntityQuery`: Optional terms query. If requesting specific fields, fields must always include the ID.

_Returns_

- Records.
- `EntityRecord[] | null`: Records.

### getLastEntityDeleteError

Expand All @@ -302,9 +302,9 @@ Returns the specified entity record's last delete error.
_Parameters_

- _state_ `State`: State tree.
- _kind_ `Kind`: Entity kind.
- _name_ `Name`: Entity name.
- _recordId_ `GenericRecordKey`: Record ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _recordId_ `EntityRecordKey`: Record ID.

_Returns_

Expand All @@ -317,9 +317,9 @@ Returns the specified entity record's last save error.
_Parameters_

- _state_ `State`: State tree.
- _kind_ `Kind`: Entity kind.
- _name_ `Name`: Entity name.
- _recordId_ `GenericRecordKey`: Record ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _recordId_ `EntityRecordKey`: Record ID.

_Returns_

Expand All @@ -333,9 +333,9 @@ with its attributes mapped to their raw values.
_Parameters_

- _state_ `State`: State tree.
- _kind_ `K`: Entity kind.
- _name_ `N`: Entity name.
- _key_ `KeyOf< K, N >`: Record's key.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _key_ `EntityRecordKey`: Record's key.

_Returns_

Expand Down Expand Up @@ -421,9 +421,9 @@ and false otherwise.
_Parameters_

- _state_ `State`: State tree.
- _kind_ `K`: Entity kind.
- _name_ `N`: Entity name.
- _recordId_ `KeyOf< K, N >`: Record ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _recordId_ `EntityRecordKey`: Record ID.

_Returns_

Expand All @@ -437,9 +437,9 @@ or false otherwise.
_Parameters_

- _state_ `State`: State tree
- _kind_ `K`: Entity kind.
- _name_ `N`: Entity name.
- _query_ `EntityQuery< C >`: Optional terms query.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _query_ `EntityQuery`: Optional terms query.

_Returns_

Expand All @@ -453,7 +453,7 @@ _Parameters_

- _state_ `State`: State tree.
- _postType_ `string`: The type of the parent post.
- _postId_ `GenericRecordKey`: The id of the parent post.
- _postId_ `EntityRecordKey`: The id of the parent post.

_Returns_

Expand Down Expand Up @@ -492,9 +492,9 @@ Returns true if the specified entity record is autosaving, and false otherwise.
_Parameters_

- _state_ `State`: State tree.
- _kind_ `Kind`: Entity kind.
- _name_ `Name`: Entity name.
- _recordId_ `GenericRecordKey`: Record ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _recordId_ `EntityRecordKey`: Record ID.

_Returns_

Expand All @@ -507,9 +507,9 @@ Returns true if the specified entity record is deleting, and false otherwise.
_Parameters_

- _state_ `State`: State tree.
- _kind_ `Kind`: Entity kind.
- _name_ `Name`: Entity name.
- _recordId_ `GenericRecordKey`: Record ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _recordId_ `EntityRecordKey`: Record ID.

_Returns_

Expand Down Expand Up @@ -553,9 +553,9 @@ Returns true if the specified entity record is saving, and false otherwise.
_Parameters_

- _state_ `State`: State tree.
- _kind_ `K`: Entity kind.
- _name_ `N`: Entity name.
- _recordId_ `KeyOf< K, N >`: Record ID.
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _recordId_ `EntityRecordKey`: Record ID.

_Returns_

Expand Down