Skip to content
Source
Sign inSign up
TanStack/store

Error in this project's derived.d.ts after pnpm install tanstack/vue-form #188

Closedjobelenus(GitHub profile, opens in a new tab) opened this issue 3 comments

Describe the bug

Attempting to use this package (as a dep of another package) fails:

 ERROR(vue-tsc)  Type parameter declaration expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:23:38

    21 |     fn: (props: DerivedFnProps<TArr>) => TState;
    22 | }
  > 23 | export declare class Derived<TState, const TArr extends ReadonlyArray<Derived<any> | Store<any>> = ReadonlyArray<any>> {
       |                                      ^^^^^
    24 |     listeners: Set<Listener<TState>>;
    25 |     state: TState;
    26 |     prevState: TState | undefined;

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:23:49

    21 |     fn: (props: DerivedFnProps<TArr>) => TState;
    22 | }
  > 23 | export declare class Derived<TState, const TArr extends ReadonlyArray<Derived<any> | Store<any>> = ReadonlyArray<any>> {
       |                                                 ^^^^^^^
    24 |     listeners: Set<Listener<TState>>;
    25 |     state: TState;
    26 |     prevState: TState | undefined;

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:23:70

    21 |     fn: (props: DerivedFnProps<TArr>) => TState;
    22 | }
  > 23 | export declare class Derived<TState, const TArr extends ReadonlyArray<Derived<any> | Store<any>> = ReadonlyArray<any>> {
       |                                                                      ^
    24 |     listeners: Set<Listener<TState>>;
    25 |     state: TState;
    26 |     prevState: TState | undefined;

 ERROR(vue-tsc)  Expression expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:23:98

    21 |     fn: (props: DerivedFnProps<TArr>) => TState;
    22 | }
  > 23 | export declare class Derived<TState, const TArr extends ReadonlyArray<Derived<any> | Store<any>> = ReadonlyArray<any>> {
       |                                                                                                  ^
    24 |     listeners: Set<Listener<TState>>;
    25 |     state: TState;
    26 |     prevState: TState | undefined;

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:24:37

    22 | }
    23 | export declare class Derived<TState, const TArr extends ReadonlyArray<Derived<any> | Store<any>> = ReadonlyArray<any>> {
  > 24 |     listeners: Set<Listener<TState>>;
       |                                     ^
    25 |     state: TState;
    26 |     prevState: TState | undefined;
    27 |     options: DerivedOptions<TState, TArr>;

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:25:18

    23 | export declare class Derived<TState, const TArr extends ReadonlyArray<Derived<any> | Store<any>> = ReadonlyArray<any>> {
    24 |     listeners: Set<Listener<TState>>;
  > 25 |     state: TState;
       |                  ^
    26 |     prevState: TState | undefined;
    27 |     options: DerivedOptions<TState, TArr>;
    28 |     /**

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:26:34

    24 |     listeners: Set<Listener<TState>>;
    25 |     state: TState;
  > 26 |     prevState: TState | undefined;
       |                                  ^
    27 |     options: DerivedOptions<TState, TArr>;
    28 |     /**
    29 |      * Functions representing the subscriptions. Call a function to cleanup

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:27:42

    25 |     state: TState;
    26 |     prevState: TState | undefined;
  > 27 |     options: DerivedOptions<TState, TArr>;
       |                                          ^
    28 |     /**
    29 |      * Functions representing the subscriptions. Call a function to cleanup
    30 |      * @private

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:32:38

    30 |      * @private
    31 |      */
  > 32 |     _subscriptions: Array<() => void>;
       |                                      ^
    33 |     lastSeenDepValues: Array<unknown>;
    34 |     getDepVals: () => {
    35 |         prevDepVals: unknown[];

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:33:38

    31 |      */
    32 |     _subscriptions: Array<() => void>;
  > 33 |     lastSeenDepValues: Array<unknown>;
       |                                      ^
    34 |     getDepVals: () => {
    35 |         prevDepVals: unknown[];
    36 |         currDepVals: unknown[];

 ERROR(vue-tsc)  An element access expression should take an argument.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:35:30

    33 |     lastSeenDepValues: Array<unknown>;
    34 |     getDepVals: () => {
  > 35 |         prevDepVals: unknown[];
       |                              ^
    36 |         currDepVals: unknown[];
    37 |         prevVal: NonNullable<TState> | undefined;
    38 |     };

 ERROR(vue-tsc)  An element access expression should take an argument.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:36:30

    34 |     getDepVals: () => {
    35 |         prevDepVals: unknown[];
  > 36 |         currDepVals: unknown[];
       |                              ^
    37 |         prevVal: NonNullable<TState> | undefined;
    38 |     };
    39 |     constructor(options: DerivedOptions<TState, TArr>);

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:38:6

    36 |         currDepVals: unknown[];
    37 |         prevVal: NonNullable<TState> | undefined;
  > 38 |     };
       |      ^
    39 |     constructor(options: DerivedOptions<TState, TArr>);
    40 |     registerOnGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
    41 |     unregisterFromGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:40:5

    38 |     };
    39 |     constructor(options: DerivedOptions<TState, TArr>);
  > 40 |     registerOnGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
       |     ^^^^^^^^^^^^^^^
    41 |     unregisterFromGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
    42 |     recompute: () => void;
    43 |     checkIfRecalculationNeededDeeply: () => void;

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:41:5

    39 |     constructor(options: DerivedOptions<TState, TArr>);
    40 |     registerOnGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
  > 41 |     unregisterFromGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
       |     ^^^^^^^^^^^^^^^^^^^
    42 |     recompute: () => void;
    43 |     checkIfRecalculationNeededDeeply: () => void;
    44 |     mount: () => () => void;

 ERROR(vue-tsc)  ',' expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:42:5

    40 |     registerOnGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
    41 |     unregisterFromGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
  > 42 |     recompute: () => void;
       |     ^^^^^^^^^
    43 |     checkIfRecalculationNeededDeeply: () => void;
    44 |     mount: () => () => void;
    45 |     subscribe: (listener: Listener<TState>) => () => void;

 ERROR(vue-tsc)  Expression expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:42:26

    40 |     registerOnGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
    41 |     unregisterFromGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
  > 42 |     recompute: () => void;
       |                          ^
    43 |     checkIfRecalculationNeededDeeply: () => void;
    44 |     mount: () => () => void;
    45 |     subscribe: (listener: Listener<TState>) => () => void;

 ERROR(vue-tsc)  Expression expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:43:49

    41 |     unregisterFromGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
    42 |     recompute: () => void;
  > 43 |     checkIfRecalculationNeededDeeply: () => void;
       |                                                 ^
    44 |     mount: () => () => void;
    45 |     subscribe: (listener: Listener<TState>) => () => void;
    46 | }

 ERROR(vue-tsc)  Expression expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:44:28

    42 |     recompute: () => void;
    43 |     checkIfRecalculationNeededDeeply: () => void;
  > 44 |     mount: () => () => void;
       |                            ^
    45 |     subscribe: (listener: Listener<TState>) => () => void;
    46 | }
    47 | export {};

 ERROR(vue-tsc)  Expression expected.
 FILE  /Users/jobelenus/code/si/node_modules/.pnpm/@tanstack+store@0.7.0/node_modules/@tanstack/store/dist/esm/derived.d.ts:45:58

    43 |     checkIfRecalculationNeededDeeply: () => void;
    44 |     mount: () => () => void;
  > 45 |     subscribe: (listener: Listener<TState>) => () => void;
       |                                                          ^
    46 | }
    47 | export {};
    48 |

[vue-tsc] Found 20 errors. Watching for file changes.

The problem is with the very first error, the const inside the class typing... if I manually remove that const in the file, everything is happy...

Steps to Reproduce the Bug or Issue

> pnpm add @tanstack/vue-form

In a vue component add: import { useForm } from "@tanstack/vue-form";

Expected behavior

Zero errors from the imported package

Screenshots or Videos

No response

Platform

macOS, building with vite, using vue

Additional context

No response

  1. jobelenus(GitHub profile, opens in a new tab)commented

    It appears I need at least TS v5.0 in my project. Would love that dep to be documented? I could have easily missed it if it was :(

  2. Documented on Form's side here:

    https://tanstack.com/form/latest/docs/typescript

    Thank you! I'm functional with TS 5.0.4 (5.8.x was not a viable attempt, too much breakage)

Sign in to join this conversation.