Repository navigation
[Consistency] Use the word "record" for the entity record TypeScript types - #39251
Conversation
If I read this then I would assume the TypeScript type for a comment record would be I'm noting that I still import the |
|
@dmsnell to surface the takeaways from our chat:
It doesn't seem like an "Entity type" is a thing. All of that being said, I think this PR may be good to go as it is right now. It would be great to update the terminology used across core-data to refer to all these concepts, but that's outside of scope of this PR.
I was thinking of the entity-types (the directory name) as of a place where the TypeScript types for the entities live, unrelated to the idea of an Entity Type. It seems like we can ditch the term Entity Type entirely. |
dmsnell
left a comment
There was a problem hiding this comment.
The "Entity" seems to be the overarching concept, like a "Comment". Perhaps like a metaclass or a database table?
Not just the concept, but the apparatus that governs fetching, loading, storage, and updates. Entity is more like a Manager than a concept.
That's the only amendment I'd propose to your summary of our chat.
I was thinking of the entity-types (the directory name) as of a place where the TypeScript types for the entities live, unrelated to the idea of an Entity Type
It actually leaves open the opportunity to talk about EntityType as a new thing. Given that entityType doesn't currently exist I think we can head-off some confusion and use it to refer to the type of a record for a given entity.
That would imply removing the entity-types/record subdirectory as redundant, maybe moving the helpers and utility and base types into src/types.ts or maybe not, just leaving them inside entity-types.
Point is I don't think we need entity-types/records/comment.ts instead of entity-types/comment.ts.
Whaddyathink? Everything else in this PR is good and necessary to avoid type and lint issues. I'm approving even though I think that records subdirectory only adds indirection where none is needed, but I'm putting that into your hand to decide. Feel no pressure to merge, also none to delay.
👍 I started a PR to introduce a consistent set of terms for things, let's keep the discussion going there: #39349
Sounds fair. I created a new subdirectory so that it wouldn't get in a way of finding files such as |
f894e34 to
b7917af
Compare
d581633 to
f803ae4
Compare
Part of #39025
Description
#38666 introduced a set of TypeScript types to model entity records data. Unfortunately, these interfaces are sometimes referred to as "entity types" and some other times as "entity records". I'd like to be as precise as possible, since core-data already uses a lot of different words to name the same ideas. I recommend placing the base record types in the
BaseEntityRecordsnamespace instead of theBaseEntityTypesnamespace.Furthermore, since there is quite a few related files, this PR moves them into a subdirectory called
recordsto make the contents of theentity-typesdirectory more readable, especially when additional types likeKindandNameget merged in #39025.Testing Instructions
Audit the types. As a type-only change this won't impact the built files.
Furthermore these types have been exported by
@wordpress/core-data; thatshouldn't change (verify please 😄 )
Types of changes
This is a type-only change and won't impact the build.
Checklist:
*.native.jsfiles for terms that need renaming or removal).