Repository navigation
fix(react): Reduce error message noise - #43215
Conversation
|
@eps1lon Thank you for submitting this PR! 🔔 @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @DovydasNavickas @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @Hotell @franklixuefei @Jessidhia @saranshkataria @lukyth @zieka @dancerphil @dimitropoulos - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
|
A definition owner has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped! |
|
I think I want a few more reviewers on this, the idea seems solid to me 👍 |
I'm probably missing something but shouldn't it be more useful in the first place if typescript would just display it as |
|
@eps1lon To make sure your feedback about displaying generic arguments in the error is seen and handled appropriately, I'd recommend you file an issue on the TypeScript repo itself. Should I go ahead and merge this PR in the meantime? |
|
Yes, please. |
|
I just published |
…rop, fix tests by @sbusch * fix types for other components (compare with event and eventWrapper, they just have no special props) * also define props for view-specific event component override * fix withDragAndDrop type definition. disable automatic exports. * any is unnecessary here * fix tests * revert change to ViewsProps due to @eps1lon comments / #43215 * change DragAndDropCalendarProps from type to interface, as suggested by @DanielRosenwasser * 🤖 Merge PR #46905 Package Proclaim: Make msg parameter optional for all assertions by @JakeChampion * Make msg param optional for assertions in proclaim * Mark message and operator params of fail as optional * Update tests to check the optional parameters are indeed optionals * Make the commonjs export of proclaim point to proclaim.ok function * Add test to prove proclaim.ok points to proclaim * Properly describe props for (custom) View, with new test with wrong prop (expecting error). Pass generic types for event and resource at more places (and fix test). Plus: turned off automatic exports for index.d.ts aswell due to own Omit (added to keep compat with older TS versions). * typo * Revert strict views (with their disfunctional tests), but retain ViewProps for optional use (guarded with a test) Strict views cannot expressed du to current limitaion in TypeScript, see <microsoft/TypeScript#13195> Co-authored-by: Jake Champion <[email protected]>
…ix withDragAndDrop, fix tests by @sbusch * fix types for other components (compare with event and eventWrapper, they just have no special props) * also define props for view-specific event component override * fix withDragAndDrop type definition. disable automatic exports. * any is unnecessary here * fix tests * revert change to ViewsProps due to @eps1lon comments / DefinitelyTyped#43215 * change DragAndDropCalendarProps from type to interface, as suggested by @DanielRosenwasser * 🤖 Merge PR DefinitelyTyped#46905 Package Proclaim: Make msg parameter optional for all assertions by @JakeChampion * Make msg param optional for assertions in proclaim * Mark message and operator params of fail as optional * Update tests to check the optional parameters are indeed optionals * Make the commonjs export of proclaim point to proclaim.ok function * Add test to prove proclaim.ok points to proclaim * Properly describe props for (custom) View, with new test with wrong prop (expecting error). Pass generic types for event and resource at more places (and fix test). Plus: turned off automatic exports for index.d.ts aswell due to own Omit (added to keep compat with older TS versions). * typo * Revert strict views (with their disfunctional tests), but retain ViewProps for optional use (guarded with a test) Strict views cannot expressed du to current limitaion in TypeScript, see <microsoft/TypeScript#13195> Co-authored-by: Jake Champion <[email protected]>
…ix withDragAndDrop, fix tests by @sbusch * fix types for other components (compare with event and eventWrapper, they just have no special props) * also define props for view-specific event component override * fix withDragAndDrop type definition. disable automatic exports. * any is unnecessary here * fix tests * revert change to ViewsProps due to @eps1lon comments / DefinitelyTyped#43215 * change DragAndDropCalendarProps from type to interface, as suggested by @DanielRosenwasser * 🤖 Merge PR DefinitelyTyped#46905 Package Proclaim: Make msg parameter optional for all assertions by @JakeChampion * Make msg param optional for assertions in proclaim * Mark message and operator params of fail as optional * Update tests to check the optional parameters are indeed optionals * Make the commonjs export of proclaim point to proclaim.ok function * Add test to prove proclaim.ok points to proclaim * Properly describe props for (custom) View, with new test with wrong prop (expecting error). Pass generic types for event and resource at more places (and fix test). Plus: turned off automatic exports for index.d.ts aswell due to own Omit (added to keep compat with older TS versions). * typo * Revert strict views (with their disfunctional tests), but retain ViewProps for optional use (guarded with a test) Strict views cannot expressed du to current limitaion in TypeScript, see <microsoft/TypeScript#13195> Co-authored-by: Jake Champion <[email protected]>
We currently can't allow all possible react nodes as return types from render since these are hardcoded into TypeScript. It's therefore very likely that one encounters TypeScript errors that are false alarms e.g.
const FunctionComponent5: React.FunctionComponent = () => false;. These produce noisy error messages and frustrated users:With this change we remove the "noise".
Before:

After:

in vscode 1.43.0 using typescript 3.8.3