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
the generated types contain some contradictions which typescript does not detect due to the strict flag in the tsconfig.json being set to false.
this is a problem when a consuming project tries to enable exactOptionalPropertyTypes: now typescript considers these contradictions to be hard errors and refuses to compile.
one example are VectorTileSource and the interface ISource it implements:
ISource says "the prepare property does not have to exist, but if it exists, it has to be a function."
i'm not sure why VectorTileSource requires a prepare property to exist - if this is not strictly necessary, just removing the prepare property would solve the issue. May be confusing for a user who sets prepare and it unexpectedly does not do anything, though.
another way to solve this would be to change ISource do use readonly prepare?: () => void|undefined; which is a bit unsatisfying because now there are two different ways to express that prepare is not a function which should be called.
in general i think a typescript library should strive for the most strict typescript variant as not to limit how strict a consuming project wants to be configured.
The text was updated successfully, but these errors were encountered:
the generated types contain some contradictions which typescript does not detect due to the
strict
flag in the tsconfig.json being set tofalse
.this is a problem when a consuming project tries to enable
exactOptionalPropertyTypes
: now typescript considers these contradictions to be hard errors and refuses to compile.one example are VectorTileSource and the interface ISource it implements:
ISource says "the prepare property does not have to exist, but if it exists, it has to be a function."
On the other hand VectorTileSource says "the property prepage must exists, and it has to be a value of type undefined.
i'm not sure why VectorTileSource requires a prepare property to exist - if this is not strictly necessary, just removing the prepare property would solve the issue. May be confusing for a user who sets prepare and it unexpectedly does not do anything, though.
another way to solve this would be to change ISource do use
readonly prepare?: () => void|undefined;
which is a bit unsatisfying because now there are two different ways to express that prepare is not a function which should be called.in general i think a typescript library should strive for the most strict typescript variant as not to limit how strict a consuming project wants to be configured.
The text was updated successfully, but these errors were encountered: