Skip to content

[Bug]: Cannot import typings from @rslib/core #567

@patricklafrance

Description

@patricklafrance

Version

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13700H
    Memory: 8.66 GB / 31.62 GB
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527

Details

I cannot import a config type like EcmaScriptVersion from @rslib/core.

Example:

import { type EcmaScriptVersion } from "@rslib/core";

I get the following error: "Module '"@rslib/core"' has no exported member 'EcmaScriptVersion'.ts(2305)"

Image

Now, If I go into my local node_modules directory and update the source code of the @rslib/core package I can get it to work, byy updating the node_modules/@rslib/core/dist-types/types/index.d.ts file.

Before:

export type * from "./config";
export type * from './utils';

Now:

export type * from './config/index.d.ts';
export type * from './utils';

Now I can import the type:

Image

I am using Typescript 5.5.4 and my tsconfig.json file is:

{
    "$schema": "https://json.schemastore.org/tsconfig",
    "compilerOptions": {
        "allowImportingTsExtensions": true,
        "moduleResolution": "NodeNext",
        "module": "NodeNext",
        "target": "ESNext",
        "lib": ["dom", "dom.iterable", "esnext"],

        "isolatedModules": true,
        "allowSyntheticDefaultImports": true,
        "resolveJsonModule": true,

        "strict": true,

        "allowJs": true,
        "checkJs": false,

        "esModuleInterop": true,
        "skipLibCheck": true,
        "forceConsistentCasingInFileNames": true,

        "noEmit": true,
        "sourceMap": false,

        "jsx": "react-jsx"
    }
}

Thanks for your help!

Patrick

Reproduce link

https://github.com/patricklafrance/rslib-import-config-types

Reproduce Steps

import { type EcmaScriptVersion } from "@rslib/core";

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions