Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An index signature parameter type must be either 'string' or 'number'. #92

Open
crgardner opened this issue Nov 30, 2023 · 2 comments
Open

Comments

@crgardner
Copy link

Receiving the above error message after running npm start. Specifically, doesn't like ./node_modules/@types/babel__traverse/index.d.ts:

// this is good enough for non-visitor traverse options e.g. noScope

  | [k: ${string}\|${string}]: VisitNode<S, Node>;
  | };

Environment

  • macOs Ventura 13.6 (22G120)
  • node v21.3.0
  • npm 10.2.4
    (tried with older versions of node and npm, too)

Reproduce

  1. npm init stencil
  2. Choose app [community]. Project is created.
  3. Change directory to project.
  4. npm install
  5. npm start. Browser starts. Transpile and other activity status displayed. Then error message "An index signature parameter type must be either 'string' or 'number'" along with the babel details shown above are displayed. Alos, see the same error message in the console as well as "build failed, watching for changes"
@bitomic
Copy link

bitomic commented Jan 14, 2024

You can use npm overrides or yarn resolutions to enforce an older version of @types/babel__traverse instead of latest.

Using yarn, you add this to your package.json:

{
    "resolutions": {
        "@types/babel__traverse": "7.0.6"
    }
}

Run yarn to install the dependencies, and yarn start should work now.

@robMolloy
Copy link

robMolloy commented Jan 22, 2024

Just to rewrite the previous (excellent) answer more explicitly,

You may want to add both of the following within package.json to give more flexibility (resolutions works with yarn, overrides works with npm, feel free to delete as it suits you)

{
  "resolutions": {
    "@types/babel__traverse": "7.0.6"
  },
  "overrides": {
    "@types/babel__traverse": "7.0.6"
  }
}

If using yarn, run yarn then yarn start
If using npm, run npm i then npm run start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants