whitphx/streamlit-component-template-react-hooks

Typescript error

freyastreamlit opened this issue · 3 comments

HI,

Attempted to use this template, but after an npm install getting a Typescript error in one of the dependencies

TypeScript error in /.../frontend/node_modules/@types/babel__traverse/index.d.ts(68,50):
']' expected.  TS1005

    66 | }
    67 | 
  > 68 | export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
       |                                                  ^
    69 | 
    70 | export class Scope {
    71 |     constructor(path: NodePath, parentScope?: Scope);

Do you get this at your end? Suggestions?

Have upgraded typescript to

  "devDependencies": {
    "typescript": "^4.6.2"
  },

and is working fine
(sent a PR just in case...)

Hi, thank you for reporting this and sending a PR!
Actually, I couldn't reproduce this error, so your PR is so helpful that saves me investigating the root cause!


Appendix:
The commands I tested

mkdir react-template-test
cd react-template-test
cp -r /path/to/streamlit-component-template-react-hooks/template .
cd template/my_component/frontend
rm -rf node_modules
rm -rf build
npm install

As I merged your PR (thanks again!), let me close this issue.
Please reopen it or create a new one if you find some problems again :)