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

Module '"spacetime"' has no exported member 'Spacetime'. Did you mean to use 'import Spacetime from "spacetime"' instead? #407

Closed
antonstefer opened this issue Feb 2, 2024 · 4 comments

Comments

@antonstefer
Copy link

Setup

package.json:

{
    "type": "module"
    "dependencies" : {
        "spacetime": "7.5.0",
        "typescript": "5.0.4"
    }
}

tsconfig.json:

{
    "extends": "@tsconfig/node20/tsconfig.json",
    "compilerOptions": {
        "lib": ["es2023"],
        "module": "node16",
        "moduleResolution": "node16"
        "target": "es2022",

        "strict": true,
        "esModuleInterop": true,
        "skipLibCheck": true,
        "forceConsistentCasingInFileNames": true,
        "useUnknownInCatchVariables": false,
        "noUnusedLocals": true,
        "resolveJsonModule": true,

        "outDir": "dist/",
        "baseUrl": ".",
        "verbatimModuleSyntax": true
    },
    "exclude": ["node_modules"],
}

Problem

Importing Spacetime like this:

import type { Spacetime } from 'spacetime'
import spacetime from 'spacetime'

produces the following Typescript error:

TS2614: Module '"spacetime"' has no exported member 'Spacetime'. Did you mean to use 'import Spacetime from "spacetime"' instead?

Directly importing from spacetime/types/types like mentioned here does not work as well:

TS2307: Cannot find module 'spacetime/types/types' or its corresponding type declarations.

Is there another way to import the types or is something broken?
This syntax has been working when my project was still using CommonJS.

Thank you!

@jecraig
Copy link
Contributor

jecraig commented Feb 2, 2024

Can you create a small repo that recreates this issue.

@antonstefer
Copy link
Author

@spencermountain
Copy link
Owner

Thank you Anton! Will keep this open until it's released, in the next few days.
cheers

@spencermountain
Copy link
Owner

released as 7.6.0
cheers!

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

No branches or pull requests

3 participants