Closed prabir-vora closed 2 years ago
@prabir-vora thanks for reaching out, what version of typescript are you using?
@prabir-vora thanks for reaching out, what version of typescript are you using?
@vanGalilea Earlier I was using version 3 but it didn't work. So I upgraded to the latest version 4.7.4 but no luck.
@prabir-vora can you post the type errors that you get after upgrading to latest TS version please
node_modules/stream-chat/dist/types/types.d.ts:411:37 - error TS1005: '>' expected.
411 i18n?: RequireAtLeastOne<Record<${TranslationLanguages}_text
, string>> & {
node_modules/stream-chat/dist/types/types.d.ts:411:78 - error TS1109: Expression expected.
411 i18n?: RequireAtLeastOne<Record<`${TranslationLanguages}_text`, string>> & {
~
node_modules/stream-chat/dist/types/types.d.ts:412:39 - error TS1005: ',' expected.
412 language: TranslationLanguages;
~
node_modules/stream-chat/dist/types/types.d.ts:414:22 - error TS1109: Expression expected.
414 latest_reactions?: ReactionResponse<StreamChatGenerics>[];
~
node_modules/stream-chat/dist/types/types.d.ts:415:21 - error TS1109: Expression expected.
415 mentioned_users?: UserResponse<StreamChatGenerics>[];
~
node_modules/stream-chat/dist/types/types.d.ts:416:19 - error TS1109: Expression expected.
416 own_reactions?: ReactionResponse<StreamChatGenerics>[] | null;
~
node_modules/stream-chat/dist/types/types.d.ts:417:17 - error TS1109: Expression expected.
417 pin_expires?: string | null;
~
node_modules/stream-chat/dist/types/types.d.ts:418:15 - error TS1109: Expression expected.
418 pinned_at?: string | null;
~
node_modules/stream-chat/dist/types/types.d.ts:419:15 - error TS1109: Expression expected.
419 pinned_by?: UserResponse<StreamChatGenerics> | null;
~
node_modules/stream-chat/dist/types/types.d.ts:419:50 - error TS1005: '(' expected.
419 pinned_by?: UserResponse<StreamChatGenerics> | null;
~
node_modules/stream-chat/dist/types/types.d.ts:419:56 - error TS1005: ')' expected.
419 pinned_by?: UserResponse<StreamChatGenerics> | null;
~
node_modules/stream-chat/dist/types/types.d.ts:420:21 - error TS1109: Expression expected.
420 reaction_counts?: {
~
node_modules/stream-chat/dist/types/types.d.ts:421:13 - error TS1005: ']' expected.
421 [key: string]: number;
~
node_modules/stream-chat/dist/types/types.d.ts:421:21 - error TS1005: ',' expected.
421 [key: string]: number;
~
node_modules/stream-chat/dist/types/types.d.ts:421:22 - error TS1136: Property assignment expected.
421 [key: string]: number;
~
node_modules/stream-chat/dist/types/types.d.ts:421:30 - error TS1005: ',' expected.
421 [key: string]: number;
~
node_modules/stream-chat/dist/types/types.d.ts:423:21 - error TS1109: Expression expected.
423 reaction_scores?: {
~
node_modules/stream-chat/dist/types/types.d.ts:424:13 - error TS1005: ']' expected.
424 [key: string]: number;
~
node_modules/stream-chat/dist/types/types.d.ts:424:21 - error TS1005: ',' expected.
424 [key: string]: number;
~
node_modules/stream-chat/dist/types/types.d.ts:424:22 - error TS1136: Property assignment expected.
424 [key: string]: number;
~
node_modules/stream-chat/dist/types/types.d.ts:424:30 - error TS1005: ',' expected.
424 [key: string]: number;
~
node_modules/stream-chat/dist/types/types.d.ts:426:17 - error TS1109: Expression expected.
426 reply_count?: number;
~
node_modules/stream-chat/dist/types/types.d.ts:427:14 - error TS1109: Expression expected.
427 shadowed?: boolean;
~
node_modules/stream-chat/dist/types/types.d.ts:428:12 - error TS1109: Expression expected.
428 silent?: boolean;
~
node_modules/stream-chat/dist/types/types.d.ts:429:12 - error TS1109: Expression expected.
429 status?: string;
~
node_modules/stream-chat/dist/types/types.d.ts:430:25 - error TS1109: Expression expected.
430 thread_participants?: UserResponse<StreamChatGenerics>[];
~
node_modules/stream-chat/dist/types/types.d.ts:431:10 - error TS1109: Expression expected.
431 type?: MessageLabel;
~
node_modules/stream-chat/dist/types/types.d.ts:432:16 - error TS1109: Expression expected.
432 updated_at?: string;
~
node_modules/stream-chat/dist/types/types.d.ts:433:1 - error TS1128: Declaration or statement expected.
433 };
~
Found 29 errors.
Hey @prabir-vora, I created a test project. I can find the same 29 errors if I am on typescript v3.9, but not on typescript v4.7.4. Please make sure that you have properly reinstalled typescript. After changing the package.json, run npm install
or yarn
again. And then run your build command again.
I believe the issue is because of TypeScript strict mode. Strict mode enforces much more stringent typing requirements. This is now default in Angular since version 14, and strict mode provides a lot of value as it brings to the surface many issues at compile time that would otherwise blow up an app at runtime.
My node API compilation fails while building using tsc. Getting 29 type errors in types.d.ts.
As mentioned in #834 and #841 I tried adding the "skipLibCheck": true and "lib": ["DOM"] flag to my tsconfig.json. I additionally event tried adding --skipLibCheck flag to my build command. However, the type files from stream-chat are not getting ignored.
Here is what my tsconfig.json looks like
My build command is inside package.json is
"build": "tsc --skipLibCheck --project . --outDir ./bin",