ant-design-icons
ant-design-icons copied to clipboard
Cannot build repo
After doing a clean clone and bootstrap I run into a few typescript errors:
> @ant-design/[email protected] generate /Users/mark/git/ant-design-icons/packages/icons
> cross-env TS_NODE_PROJECT=build/tsconfig.json node --require ts-node/register build/index.ts
/Users/mark/git/ant-design-icons/packages/icons/node_modules/ts-node/src/index.ts:261
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
build/generateIcons.ts(61,49): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'ThemeType'.
Type 'string[]' is not assignable to type '"twotone"'.
build/generateIcons.ts(80,31): error TS2344: Type 'BuildTimeIconMetaData' does not satisfy the constraint 'ObservableInput<any>'.
Property '[Symbol.iterator]' is missing in type 'BuildTimeIconMetaData' but required in type 'Iterable<any>'.
build/generateIcons.ts(81,20): error TS7031: Binding element 'kebabCaseName' implicitly has an 'any' type.
build/generateIcons.ts(81,35): error TS7031: Binding element 'identifier' implicitly has an 'any' type.
build/generateIcons.ts(113,49): error TS2344: Type 'BuildTimeIconMetaData' does not satisfy the constraint 'ObservableInput<any>'.
Type 'BuildTimeIconMetaData' is not assignable to type 'Iterable<any>'.
build/generateIcons.ts(114,8): error TS7006: Parameter 'metaData$' implicitly has an 'any' type.
build/generateIcons.ts(205,49): error TS2344: Type 'BuildTimeIconMetaData' does not satisfy the constraint 'ObservableInput<any>'.
Type 'BuildTimeIconMetaData' is not assignable to type 'Iterable<any>'.
build/generateIcons.ts(206,8): error TS7006: Parameter 'metaData$' implicitly has an 'any' type.
build/generateIcons.ts(230,41): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'ThemeType'.
Type 'string[]' is not assignable to type '"twotone"'.
at createTSError (/Users/mark/git/ant-design-icons/packages/icons/node_modules/ts-node/src/index.ts:261:12)
at getOutput (/Users/mark/git/ant-design-icons/packages/icons/node_modules/ts-node/src/index.ts:367:40)
at Object.compile (/Users/mark/git/ant-design-icons/packages/icons/node_modules/ts-node/src/index.ts:558:11)
at Module.m._compile (/Users/mark/git/ant-design-icons/packages/icons/node_modules/ts-node/src/index.ts:439:43)
at Module._extensions..js (internal/modules/cjs/loader.js:745:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/mark/git/ant-design-icons/packages/icons/node_modules/ts-node/src/index.ts:442:12)
at Module.load (internal/modules/cjs/loader.js:626:32)
at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
at Function.Module._load (internal/modules/cjs/loader.js:558:3)
at Module.require (internal/modules/cjs/loader.js:663:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ant-design/[email protected] generate: `cross-env TS_NODE_PROJECT=build/tsconfig.json node --require ts-node/register build/index.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ant-design/[email protected] generate script.
Tested with both node 8 and node 11 with the latest versions of yarn/npm/lerna.
After a bit of fiddling with the code it looks like its just purely a typescript issue, taking out the typescript casts for ThemeType in a few areas let the code pass and it works just fine.
I believe this might just be wrong types being used? Since the pipe starts off passing a string[]
of the 3 types of theme icons but ThemeType is just an enum of the 3 types so maybe the type cast should be a ThemeType[] instead?
I'm not fully versed in Typescript so I could be wrong but im not sure how else this managed to build previously.
If on windows you should pin your typescript version: https://github.com/NG-ZORRO/ng-zorro-antd/pull/2798#issuecomment-455094564 https://github.com/Microsoft/TypeScript/issues/29221