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
{{ message }}
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.
A user created a plugin with name x that takes a number:
tippy(reference,{x: 1000,plugins: [x]});
We introduce a new native prop with name x that takes a string
tippy(reference,{x: 'content'})
interfaceProps{// ...x: string;}
With a runtime bailout check we can prevent errors and add a warning that their plugin now conflicts with a native prop (I expect this to be very rare):
bailIfPlugin(plugins,'x',()=>{...});
But for types, there is a problem. If they weren't typing their plugin prop, they will now get an error since Props now has x types as string, but they are passing in number.
Is it fine that types can suddenly emit errors/warnings upon minor updates? Or do we need to remove [key: string]: any and force strict types (which will still emit errors if they weren't strict typing their plugin prop, but only for that release, not future ones that introduce new props)?
Looking at the DefinitelyTyped repo, changes in types happen frequently for correctness between minors and aren't considered breaking changes. Even TS itself introduces breaking in minors.
I'm in favor of stricter types. Maybe TypeScript itself doesn't encourage strict typing by default (exhibit 1 and 2), it is a good idea to promote strictness wherever possible (exhibit 1). If you don't want types, you can just use plain JS.
A user created a plugin with name
x
that takes anumber
:We introduce a new native prop with name
x
that takes astring
With a runtime bailout check we can prevent errors and add a warning that their plugin now conflicts with a native prop (I expect this to be very rare):
But for types, there is a problem. If they weren't typing their plugin prop, they will now get an error since
Props
now hasx
types asstring
, but they are passing innumber
.Is it fine that types can suddenly emit errors/warnings upon minor updates? Or do we need to remove
[key: string]: any
and force strict types (which will still emit errors if they weren't strict typing their plugin prop, but only for that release, not future ones that introduce new props)?Looking at the DefinitelyTyped repo, changes in types happen frequently for correctness between minors and aren't considered breaking changes. Even TS itself introduces breaking in minors.
/cc @KubaJastrz
The text was updated successfully, but these errors were encountered: