Comments (13)
Could you provide the use cases or concrete code slices?
Is it only a linting warning about potential issues or are there any real failures?
Here is the test case only for ts definition: https://github.com/kaelzhang/node-ignore/blob/master/test/ts/simple.ts
from node-ignore.
Sure and it's a real typescript typing/intellisense failure, not just linting. I ran into this in my own project here:
https://github.com/snowcoders/sortier/pull/2226/files#diff-55dee8ec3daf30391537fdc45f8c2639cca5d3e63faf83671ee7505eeb8fed03R10
I think with typescript + node16 resolution, when you share a single types file with cjs and esm, it seems to assume cjs. In this code, I had to @ts-expect-error because ignore
here was the import module and typescript wanted me to use ignore.default()
. Obviously that doesn't match your build output so I had to ignore the error to be able to get the program to continue to run.
If you need a repo environment, that project should work, just removed the @ts-expect-error and you should see the same bug. If that doesn't work for you, creating a narrowed reproduction repo wouldn't be difficult, it will just take a few days since the work week is starting.
from node-ignore.
It is really weird that tsc
treats packages with/without type: module
differently.
- ❌
tsc ./src/lib/is-ignored/index.ts --moduleResolution Node16
failed withtype:module
in package.json - ✅
tsc ./src/lib/is-ignored/index.ts --moduleResolution Node16
succeeded with notype:module
in package.json - ✅
tsc ./src/lib/is-ignored/index.ts
succeeded
from node-ignore.
@kaelzhang I think the only way to fix this is to add a real esm output:
{
"name": "ignore",
"version": "5.3.0",
"main": "index.js",
"module": "index.mjs",
"types": "index.d.ts"
}
from node-ignore.
Related Issues (20)
- Options merge HOT 4
- Suggested replacement for addIgnoreFile doesn't work always HOT 4
- Clarify "unignored" result of "test" method HOT 9
- Escapes and spaces are not handled correctly HOT 2
- TypeScript: add support for `readonly string[]`
- Negate broken HOT 1
- [Feature] Add export field or new package to render real world gitignore? HOT 2
- [Feature] npm exec script HOT 1
- wrong result for node_modules HOT 2
- directory ending with / not always correctly ignored HOT 7
- Find out which paths to watch HOT 4
- Negative pattern ignored when inside a subdirectory HOT 2
- Negated directory inclusion fails with glob HOT 1
- Trailing backslash in the ignore file is throwing a syntax error. HOT 1
- \# does not work HOT 1
- Pathname should be a path.relative()d pathname Error with ../ path HOT 2
- Add support for OR syntax `{js,ts}` HOT 3
- foo/* not correctly respected HOT 4
- "*.app" ignores "Notificator.app/Contents/PkgInfo" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-ignore.