https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
b

brave-plastic-40888

01/16/2024, 1:59 PM
hey folks, I have a node.js project using typescript, when I compile my code I am getting bunch of errors from growthbook:
Copy code
nn@xxxx project % tsc index.ts                                     
node_modules/@growthbook/growthbook/dist/types/growthbook.d.ts:5:9 - error TS2717: Subsequent property declarations must have the same type.  Property '_growthbook' must be of type 'GrowthBook<Record<string, any>>', but here has type 'GrowthBook<Record<string, any>>'.

5         _growthbook?: GrowthBook;
          ~~~~~~~~~~~

  node_modules/@growthbook/growthbook/src/types/growthbook.ts:8:5
    8     _growthbook?: GrowthBook;
          ~~~~~~~~~~~
    '_growthbook' was also declared here.

node_modules/@growthbook/growthbook/src/feature-repository.ts:258:29 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(timeoutId: string | number | Timeout): void', gave the following error.
    Argument of type 'Timer' is not assignable to parameter of type 'string | number | Timeout'.
      Property '[Symbol.dispose]' is missing in type 'Timer' but required in type 'Timeout'.
  Overload 2 of 2, '(id: number): void', gave the following error.
    Argument of type 'Timer' is not assignable to parameter of type 'number'.

258       timer && clearTimeout(timer as NodeJS.Timer);
                                ~~~~~~~~~~~~~~~~~~~~~

  node_modules/@types/node/timers.d.ts:130:17
    130                 [Symbol.dispose](): void;
                        ~~~~~~~~~~~~~~~~
    '[Symbol.dispose]' is declared here.

node_modules/dom-mutator/dist/index.d.ts:4:33 - error TS2304: Cannot find name 'HTMLMutation'.

4 declare function html(selector: HTMLMutation['selector'], mutate: HTMLMutation['mutate']): MutationController;
                                  ~~~~~~~~~~~~

node_modules/dom-mutator/dist/index.d.ts:4:67 - error TS2304: Cannot find name 'HTMLMutation'.

4 declare function html(selector: HTMLMutation['selector'], mutate: HTMLMutation['mutate']): MutationController;
                                                                    ~~~~~~~~~~~~

node_modules/dom-mutator/dist/index.d.ts:5:37 - error TS2304: Cannot find name 'PositionMutation'.

5 declare function position(selector: PositionMutation['selector'], mutate: PositionMutation['mutate']): MutationController;
                                      ~~~~~~~~~~~~~~~~

node_modules/dom-mutator/dist/index.d.ts:5:75 - error TS2304: Cannot find name 'PositionMutation'.

5 declare function position(selector: PositionMutation['selector'], mutate: PositionMutation['mutate']): MutationController;
                                                                            ~~~~~~~~~~~~~~~~

node_modules/dom-mutator/dist/index.d.ts:6:36 - error TS2304: Cannot find name 'ClassnameMutation'.

6 declare function classes(selector: ClassnameMutation['selector'], mutate: ClassnameMutation['mutate']): MutationController;
                                     ~~~~~~~~~~~~~~~~~

node_modules/dom-mutator/dist/index.d.ts:6:75 - error TS2304: Cannot find name 'ClassnameMutation'.

6 declare function classes(selector: ClassnameMutation['selector'], mutate: ClassnameMutation['mutate']): MutationController;
                                                                            ~~~~~~~~~~~~~~~~~

node_modules/dom-mutator/dist/index.d.ts:7:38 - error TS2304: Cannot find name 'AttrMutation'.

7 declare function attribute(selector: AttrMutation['selector'], attribute: AttrMutation['attribute'], mutate: AttrMutation['mutate']): MutationController;
                                       ~~~~~~~~~~~~

node_modules/dom-mutator/dist/index.d.ts:7:75 - error TS2304: Cannot find name 'AttrMutation'.

7 declare function attribute(selector: AttrMutation['selector'], attribute: AttrMutation['attribute'], mutate: AttrMutation['mutate']): MutationController;
                                                                            ~~~~~~~~~~~~

node_modules/dom-mutator/dist/index.d.ts:7:110 - error TS2304: Cannot find name 'AttrMutation'.

7 declare function attribute(selector: AttrMutation['selector'], attribute: AttrMutation['attribute'], mutate: AttrMutation['mutate']): MutationController;
                                                                                                               ~~~~~~~~~~~~


Found 11 errors in 3 files.
using latest
@growthbook/growthbook
is there any way to fix it?
f

fresh-football-47124

01/17/2024, 4:40 AM
What node version are you using?
b

brave-plastic-40888

01/17/2024, 4:41 AM
18
f

fresh-football-47124

01/17/2024, 4:43 AM
@future-teacher-7046 do you know?
f

future-teacher-7046

01/17/2024, 12:38 PM
I replied to your issue. Can you share which typescript version you are using and which strict settings you have enabled? We have type checking as part of our CI/CD flow and none of these issues show up for us.
3 Views