Skip to content

@hey-api/spec-types is not compatible with moduleResolution:"nodenext" #3716

@seanwu1105

Description

@seanwu1105

Description

The new type-only package @hey-api/spec-types is not compatible with any client that use moduleResolution: "nodenext" in their tsconfig.json.

Minimal Reproduce Example

Create a TypeScript project with the following tsconfig.json:

{
  "compilerOptions": {
    "strict": true,
    "module": "nodenext",
    "moduleResolution": "nodenext",
  }
}

After installing the latest @hey-api/openapi-ts, the type of description is unresolvable and fallback to any.

import type { IR } from "@hey-api/openapi-ts";

export function myFunc(schema: IR.SchemaObject) {
  const description = schema.description;
  return description;
}
Image

Is it possible to make it compatible with moduleResolution: "nodenext"? I believe this is achievable by adding correct extensions to the imports in @hey-api/spec-types. Using the same tsdown bundler to build the package might also help.

Reproducible example or configuration

https://stackblitz.com/edit/vitejs-vite-kjtcmthu

OpenAPI specification (optional)

No response

System information (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥Broken or incorrect behavior.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions