Skip to content

Typing not working for moduleResolution nodenext #174

@jhwz

Description

@jhwz

When importing stytch using nodenext typescript isn't able to find the typings.

Could not find a declaration file for module 'stytch'. 'stytch/module.mjs' implicitly has an 'any' type.
  Try `npm i --save-dev @types/stytch` if it exists or add a new declaration (.d.ts) file containing `declare module 'stytch';`ts(7016)

You should just need to add the "types" field to your exports in package.json:

  "exports": {
    "require": "./dist/index.js",
    "import": "./dist/index.mjs",
    "types": "./types/lib/index.d.ts"
  },

Ideally, more types would be exported (User, Session, etc) like #118 mentions but that can be worked around.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions