-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Missing types when using moduleResolution
set to next
, node16
or bundler
#37
Comments
Well, I'm not sure I understand what // index.ts
import {isPlainObject} from "is-plain-object";
console.log(isPlainObject(5)); tsc index.ts --strict node --version
v16.20.2 node index.js
false This code fails though: // index.ts
import {isPlainObject} from "is-plain-object";
console.log(isPlainObject(5, 2)); // tsc index.ts --strict
index.ts:3:30 - error TS2554: Expected 1 arguments, but got 2.
3 console.log(isPlainObject(5, 2));
~
Found 1 error in index.ts:3 So, clearly, it proves that the types are perfectly resolved by the TypeScript compiler - and by my IDE's IntelliSense too. Did you actually encounter an issue yourself? If so, can you please describe it? |
If using TS with
Here's a repro: You can read more info about why this happens at https://github.com/arethetypeswrong/arethetypeswrong.github.io |
Thanks, I know why it happens. I think you should update the issue description to explain the issue as you explained it on your last comment, though. |
moduleResolution
set to next
, node16
or bundler
For those who are blocked, I've rewritten a ESM/CJS compatible implemenation in https://github.com/belgattitude/httpx/tree/main/packages/plain-object#readme. There's small differences in implementation between is-plain-object... Happy to contribute back |
If using TS with
moduleResolution
set tonode16
,nodenext
orbundler
, you get the following message:Repro on Stackblitz: https://stackblitz.com/edit/vitejs-vite-caqzew?file=package.json,src%2Fmain.ts&terminal=dev
More info on why this happens can be found on arethetypeswrong/arethetypeswrong.github.io
Link to the type analysis and the output:
https://arethetypeswrong.github.io/?p=is-plain-object%405.0.0
Problems
❌ No types
Import resolved to JavaScript files, but no type declarations were found.
Another package linter output:
https://publint.dev/[email protected]
The text was updated successfully, but these errors were encountered: