Test Repo: https://github.com/chenxinyanc/fabric-test
In the root folder, run
npm install
npm run build
When building with typescript 3.5.1, I see the following error
ERROR in [at-loader] ./node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts:49:75
TS2590: Expression produces a union type that is too complex to represent.
ERROR in [at-loader] ./node_modules/office-ui-fabric-react/lib/components/DetailsList/ShimmeredDetailsList.types.d.ts:10:18
TS2430: Interface 'IShimmeredDetailsListProps' incorrectly extends interface 'IDetailsListProps'.
Types of property 'styles' are incompatible.
Type 'IStyleFunctionOrObject<IShimmeredDetailsListStyleProps, IShimmeredDetailsListStyles>' is not assignable to type 'IStyleFunctionOrObject<IDetailsListStyleProps, IDetailsListStyles>'.
Type 'IStyleFunction<IShimmeredDetailsListStyleProps, IShimmeredDetailsListStyles>' is not assignable to type 'IStyleFunctionOrObject<IDetailsListStyleProps, IDetailsListStyles>'.
Type 'IStyleFunction<IShimmeredDetailsListStyleProps, IShimmeredDetailsListStyles>' is not assignable to type 'IStyleFunction<IDetailsListStyleProps, IDetailsListStyles>'.
Type 'IShimmeredDetailsListStyles' is missing the following properties from type 'IDetailsListStyles': focusZone, headerWrapper, contentWrapper
The file context with error is TStyleSet['subComponentStyles'][P] as in:
https://github.com/OfficeDev/office-ui-fabric-react/blob/ad9193054e3542ca04f265821fca34c51e68b9ff/packages/merge-styles/src/IStyleSet.ts#L35-L41
And the suffx [P] is the direct (but not root) cause of TS2590 error.
There shouldn't be any error, just like it when I'm building with typescript 3.4.5.
Are you willing to submit a PR to fix? Yes, but I'm currently not sure how to refactor IStyleSet safely.
Requested priority: Normal
Products/sites affected: N/A
I already have a fix for this for our fabric-7 branch. I'll port to master.
I was seeing the same issue with TSC v3.3.3333, FYI, but the issue is new.
Here is the exact error I'm seeing, but I'm suspicious that it is coming from including a different dependency, since this isn't the first flaky "styles" related issue I've seen show up today.
../../node_modules/office-ui-fabric-react/lib/components/DetailsList/ShimmeredDetailsList.types.d.ts(10,18): error TS2430: Interface 'IShimmeredDetailsListProps' incorrectly extends interface 'IDetailsListProps'.
Types of property 'styles' are incompatible.
Type 'IStyleFunction<IShimmeredDetailsListStyleProps, IShimmeredDetailsListStyles> | Partial<IShimmeredDetailsListStyles> | undefined' is not assignable to type 'IStyleFunction<IDetailsListStyleProps, IDetailsListStyles> | Partial<IDetailsListStyles> | undefined'.
Type 'IStyleFunction<IShimmeredDetailsListStyleProps, IShimmeredDetailsListStyles>' is not assignable to type 'IStyleFunction<IDetailsListStyleProps, IDetailsListStyles> | Partial<IDetailsListStyles> | undefined'.
Type 'IStyleFunction<IShimmeredDetailsListStyleProps, IShimmeredDetailsListStyles>' is not assignable to type 'IStyleFunction<IDetailsListStyleProps, IDetailsListStyles>'.
Type 'IShimmeredDetailsListStyles' is missing the following properties from type 'IDetailsListStyles': focusZone, headerWrapper, contentWrapper
npm ERR! code ELIFECYCLE
npm ERR! errno 2
I fixed that error too. I'll have a PR up here shortly. Thanks for the reference project @chenxinyanc !
:tada:This issue was addressed in #9336, which has now been successfully released as @uifabric/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #9336, which has now been successfully released as [email protected].:tada:
Handy links:
Most helpful comment
I already have a fix for this for our
fabric-7branch. I'll port tomaster.