Module "..." cannot be named without a reference to "..." error when decl emitting references to nested modules
See original GitHub issueBug Report
🔎 Search Terms
cannot be named without a reference to symlink
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
N/A
💻 Code
https://github.com/jcreamer898/monorepo-examples/tree/main/pnpm-example
TL;DR file layout:
// monorepo-examples\pnpm-example\packages\pkg-a\index.ts
import { FontSizes, FontWeights, ITheme, IStyle } from "@fluentui/react";
// This expression's inferred type depends on @fluentui/merge-styles
export const something = { ...
@fluentui/react
is nested in /monorepo-examples/pnpm-example/node_modules/.pnpm/@fluentui+react
Adding a blank import to @fluentui/merge-styles
in index.ts
makes the problem go away
🙁 Actual behavior
src/index.ts:28:14 - error TS2742: The inferred type of 'personScopeListItemOverrides' cannot be named without a reference to '.pnpm/@fluentui+merge-styles@8.3.0/node_modules/@fluentui/merge-styles'. This is likely not portable. A type annotation is necessary.
🙂 Expected behavior
No error
Issue Analytics
- State:
- Created 2 years ago
- Reactions:20
- Comments:10 (2 by maintainers)
Top Results From Across the Web
TS4023: Exported Variable <x> has or is using name <y> from ...
When trying to emit [the module], the compiler needs to write an object type ... so the type "cannot be named" and there's...
Read more >Modules · The Julia Language
Within a module, a variable name can be “reserved” without assigning to it ... Here, Julia cannot decide which f you are referring...
Read more >7. Simple statements — Python 3.11.1 documentation
If the name does not occur in a global or nonlocal statement in the current code ... If the target is an attribute...
Read more >Strict mode - JavaScript - MDN Web Docs
Browsers not supporting strict mode will run strict mode code with ... every name not referring to an argument or local variable must...
Read more >Announcing TypeScript 4.7 - Microsoft Developer Blogs
This code works in CommonJS modules, but will fail in ES modules because relative import paths need to use extensions. As a result,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Althought I don’t know why ,
"preserveSymlinks": true
resolved my problemsWe’re also running into this with https://github.com/saiichihashimoto/sanity-typed-schema-builder/issues/155. It’s unclear what should happen here, considering transitive type dependencies should work.