Skip to content

Commit

Permalink
Use explicit type definitions for entity configuration (#40995)
Browse files Browse the repository at this point in the history
Add Entity configuration types to core-data/src/entities.ts for the selector types to lean upon in the upcoming PR.

Writing the kind and name twice is a trade-off. I've spent hours exploring the available options with @dmsnell and we concluded that it's only possible to either:

* Infer it from the config and miss out on autocompletion, config type validation, and require using as const. Reuse the JS entities configuration in the TypeScript type system #40024 explored that
* Infer it from the config and have all of the above, but at the cost of using super complex type plumbing. This TS playground explores that
* Type it explicitly, have autocompletion and type validation without complex types, but duplicate a few lines of code.

This commit implements the latter approach.
  • Loading branch information
adamziel authored May 23, 2022
1 parent 93c84f9 commit f31e8f0
Show file tree
Hide file tree
Showing 3 changed files with 470 additions and 119 deletions.
Loading

0 comments on commit f31e8f0

Please sign in to comment.