fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Compile using strictFunctionTypes: true

Open joschect opened this issue 7 years ago • 6 comments

Describe the feature that you would like added

Office-ui-fabric-react should compile with the typescript option strictFunctionTypes set to true. This would add additional type safety and help prevent potential issues with functions.

Issues requesting fix/examples of friction:

#9581 #10046

What component or utility would this be added to

Enable strictFunctionTypes in the ts compiler options

joschect avatar Aug 21 '19 17:08 joschect

adding some relevant folks to discussion

kenotron avatar Aug 21 '19 18:08 kenotron

I personally think that this can't hurt to add, if no one has objections I'll explore how much work it would be to enable it.

joschect avatar Aug 21 '19 21:08 joschect

The question is should we fix some typings that lead to incompatibility with strictFunctionTypes such as IRenderFunction? And if that's the case, would it best be done leading into a major release? At least those were the questions I had when investigating this.

KevinTCoughlin avatar Aug 21 '19 21:08 KevinTCoughlin

This came up over the List examples which use onRenderCell functions that are inconsistent with List's type and generate a type error when using strictFunctionTypes.

We're planning on upgrading to TS3.7 soon and could investigate enabling strictFunctionTypes. However, to Kevin's point, it may not be possible to enable this without interface breaks. In that case, I think it's important to transition to using strictFunctionTypes for our next major release since it helps identify these types of inconsistencies.

JasonGore avatar Dec 17 '19 22:12 JasonGore

Agreed, I think the strictFunctionTypes transition would be better done in a major release instead of with the TS 3.7 upgrade--both due to the potential for breaks and the extra work involved.

ecraig12345 avatar Dec 18 '19 19:12 ecraig12345

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

msft-fluent-ui-bot avatar Apr 26 '21 12:04 msft-fluent-ui-bot