Skip to content

Module '".contentlayer/data"' has no exported member '...'.ts(2305) #41

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

Closed
renomureza opened this issue Nov 12, 2021 · 7 comments
Closed

Comments

@renomureza
Copy link

renomureza commented Nov 12, 2021

Typescript displays error when I import data or type from .contentlayer:

// Module '".contentlayer/data"' has no exported member 'allJavascripts'.ts(2305)
import { allJavascripts } from ".contentlayer/data";
// Module '".contentlayer/types"' has no exported member 'Javascript'.ts(2305)
import { Javascript } from ".contentlayer/types";

While this still works well, I think it's quite annoying and error prone as there are no suggestions.

Repo:

Screenshot:

image

@schickling
Copy link
Collaborator

Does it work after you restarted the TS server in VSC?

@renomureza
Copy link
Author

I have done it many times:

  1. delete node_module & contentlayer directory
  2. reinstall all packages
  3. restart VSCode

it doesn't solve the problem.

@laamdev
Copy link

laamdev commented Nov 13, 2021

Does it work after you restarted the TS server in VSC?

I had the same issue and restarting the TS server solved it for me.

  1. With a .TS or .TSX file open, open the command palette with the keystroke CTRL+SHIFT+P.
  2. Enter Typescript: Restart TS Server

@CarbonGhost
Copy link

If you haven't already, ensure that you build the content using

./node_modules/.bin/contentlayer build

then restart the TS server. This fixed the issue for me.

@renomureza
Copy link
Author

@laanayam333 @CarbonGhost can you test the repo i am using,

@CarbonGhost
Copy link

... can you test the repo i am using,

I didn't run into this error when I cloned your repository locally.

@renomureza
Copy link
Author

@CarbonGhost Thanks for testing the repo I'm using.

I'm still having the same problem, I don't know if it's my editor problem or not.

I have switched to MDX Bundler.

I will close this issue.

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

4 participants