microsoft / fluentui

Fluent UI web represents a collection of utilities, React components, and web components for building web applications.
https://react.fluentui.dev
Other
18.42k stars 2.72k forks source link

Build error with SPFX @uifabric : error TS1005 #8051

Closed kachihro closed 5 years ago

kachihro commented 5 years ago

Environment Information

Actual behavior:

New webpart project using YO generator, with SPFX v1.7.1

When adding component, or any other Fabric UI component, project won't build ;

Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,124): error TS1005: ')' expected. Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,177): error TS1005: '(' expected. Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,185): error TS1005: ':' expected.

Error - [tsc] node_modules/@uifabric/foundation/node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(15,67): error TS1005: ';' expected. Error - [tsc] node_modules/@uifabric/foundation/node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(15,114): error TS1005: '(' expected. Error - [tsc] node_modules/@uifabric/foundation/node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(15,136): error TS1005: '(' expected.

Error - [tsc] node_modules/office-ui-fabric-react/node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(15,67): error TS1005: ';' expected. Error - [tsc] node_modules/office-ui-fabric-react/node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(15,114): error TS1005: '(' expected. Error - [tsc] node_modules/office-ui-fabric-react/node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(15,136): error TS1005: '(' expected. Error - 'tsc' sub task errored after 31 s

tslint version: 5.9.1 typescript version: 2.4.2 node 8.12.0


1st error - is within this line (ISlots.d.ts);

export declare type ISlotPropValue<TProps, TShorthandPropType = never> = TShorthandPropType | TProps | (TShorthandPropType extends React.ReactNode ? IPropsWithChildren : never);


2nd error - is within this line (IStyleSet.d.ts)

export declare type __MapToFunctionType = Extract<T, Function> extends never ? (...args: any[]) => Partial : Extract<T, Function>;


2nd error - is within this line (IStyleSet.d.ts)

export declare type __MapToFunctionType = Extract<T, Function> extends never ? (...args: any[]) => Partial : Extract<T, Function>;

Expected behavior:

Project will build - and not trip up on errors within these three (3) files

?? Is this a typescript compiler issue - and code is using 'new' method features ?

Priorities and help requested:

Are you willing to submit a PR to fix? (No)

Requested priority: (Blocking)

Products/sites affected: (if applicable) SPFX, webpart project

aneeshack4 commented 5 years ago

@kachihro Can you try updating your Typescript to 2.8.4? This is what office-ui-fabric-react's on so you should be able to compile then.

kachihro commented 5 years ago

I'm wondering if it's a restriction with SPFX - v1.7... Other projects, and the scaffold refer to Office UI Fabric React as v5.3.1 - does it mean that we can't include the new components (like Stack) within an SPFX webpart...? When can we expect an update to SPFX for more recent components ?

cliffkoh commented 5 years ago

@kachihro I recommend asking this question at https://github.com/SharePoint/sp-dev-docs. The UI Fabric team is not in a position to speak authoritatively about SPFx's release plans unfortunately...

cliffkoh commented 5 years ago

Duplicate of #7054