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

Can't import types #207

Closed
burtek opened this issue Jun 30, 2023 · 7 comments
Closed

Can't import types #207

burtek opened this issue Jun 30, 2023 · 7 comments

Comments

@burtek
Copy link

burtek commented Jun 30, 2023

After #204 was merged and released in 1.21.0, I can't do any type imports, i.e:

import type { FlatESLintConfigItem } from 'eslint-define-config';

image
image1

Works correctly for 1.20.0

@Shinigami92
Copy link
Collaborator

You can push this forward by forking and try to create a bugfix PR
Otherwise you need to wait some days until I'm back in "working-mode"
I'm currently enjoying the last days of my vacation and grind Diablo 4 😅

@burtek
Copy link
Author

burtek commented Jul 1, 2023

@Shinigami92 happy to take a look tomorrow evening once I'm back from in-laws 😅

@Shinigami92
Copy link
Collaborator

I now had the first time after vacation to test your issue and somehow I cannot reproduce your problem 🤔

@burtek
Copy link
Author

burtek commented Jul 3, 2023

@Shinigami92 what TS version were you testing this on?

Tried playing with it (both changing TS version, my configuration and your package.json) and can't figure out what's wrong with it...

@burtek
Copy link
Author

burtek commented Jul 3, 2023

When a file is considered an ES module, a few different rules come into play compared to CommonJS:

  • relative import paths need full extensions (e.g we have to write import "./foo.js" instead of import "./foo")

https://www.typescriptlang.org/docs/handbook/esm-node.html#type-in-packagejson-and-new-extensions

It started working correctly for me when I changed your .d.ts files to contain extensions. I think that's the issue here. But still interested of your setup, since you're saying it works for you as is?

@Shinigami92
Copy link
Collaborator

I have just a normal TypeScript esm project

I'm sorry I have not the time to debug your problems if you cannot provide a minimal reproducible

Also it starts to sound like it's a problem with your tsconfig or whatever

So I think I will close this issue for now
Feel free to reopen when you provide a minimal reproducible

@Shinigami92 Shinigami92 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2023
@burtek
Copy link
Author

burtek commented Aug 17, 2023

FFR the issue is that my project was set to have module resolution "Node16" while eslint-define-config is "Node" (a.k.a. "Node10") and those two don't play well.

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

No branches or pull requests

2 participants