question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Typescript types are not detected in nodeNext resolution environment

See original GitHub issue

Description

When using nodeNext module resolution in typescript, react-chakra-select types are not detected. Because when "exports" is present, "types" at root level supposed to be ignored

Solution is to add

“types”: “dist/types/index.d.ts”

to package.json “exports” object after “default”

chakra-react-select Version

4.2.2

Link to Reproduction

No response

TypeScript?

  • Yes I use TypeScript

Steps to reproduce

  1. Create tsconfig with "moduleResolution": "NodeNext",
  2. Include “chaka-react-select”
  3. Try to typecheck

Operating System

  • macOS
  • Windows
  • Linux
  • iOS/iPadOS
  • Android

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:22 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
csandmancommented, Sep 28, 2022

Oh, it’s already online. Cross checked and works fine.

Haha yep, I tested it myself in a test app first and it seemed to do the trick so I published quick. Didn’t want to leave a bug which breaks the whole package around for longer than I had to 😅

Thanks for confirming for me though!

2reactions
itsamcommented, Sep 27, 2022

Hello, this update broke my Next.js project (no Typescript). After upgrading to 4.2.3 I am getting

Module not found: Default condition should be last one. 
> 1 | import { Select } from "chakra-react-select";

If I remove from node_modules (package.json) the following line, then everything works fine "types": "./dist/types/index.d.ts" I have tried to remove completely node_modules and yarn.lock and install again and the problem remains…

Thanks in advance

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript module "Node16" does not resolve types of CJS ...
To expand on this, TypeScript 4.7.1-rc with nodenext module resolution is unable to resolve various NPM dependencies. See this example repo.
Read more >
Documentation - Module Resolution - TypeScript
Module resolution is the process the compiler uses to figure out what an ... Finally, if the compiler could not resolve the module,...
Read more >
TypeScript errors and how to fix them
error TS1055: Type ' AxiosPromise ' is not a valid async function return type in ... or 'nodenext', and the 'target' option is...
Read more >
TS1343: The 'import.meta' meta-property is only allowed when ...
YOUR_VAR your test will pass without import.meta.env error ... resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).
Read more >
How we employed the new ECMAScript Module Support in ...
Why use ECMAScript modules (import) instead of CommonJS (require)? ... How to use nodenext in TypeScript? How to exempt files from the type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found