You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this, and probably other similar cases, can be avoided using the const type parameters feature from Typescript 5. In index.d.ts I think every occurence of Schema can be made const in this way. For instance:
As you can see, MyEntity.collection is typed exactly like if we had used as const Using const type parameters is better than as const since it lessens the burden on the library consumers.
I haven't tested this, but my assumption is that every occurrence of
S extends Schema<A, F, C>
can be replaced with
const S extends Schema<A, F, C>
Caveats:
The type tests in the project will need a big overhaul following this change.
To use this feature I think consumers are required to use Typescript 5.
The text was updated successfully, but these errors were encountered:
The entity schema is supposed to be unchangeable. Its purpose is to provide information for queries and typings.
I noticed this info box on the collections page:
This relates to sub-collections defined in the array syntax:
I think this, and probably other similar cases, can be avoided using the const type parameters feature from Typescript 5. In
index.d.ts
I think every occurence ofSchema
can be made const in this way. For instance:Here is a small contained example:
As you can see,
MyEntity.collection
is typed exactly like if we had usedas const
Using const type parameters is better thanas const
since it lessens the burden on the library consumers.I haven't tested this, but my assumption is that every occurrence of
can be replaced with
Caveats:
The text was updated successfully, but these errors were encountered: