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

Bug: private module 'shared' is referenced in shipped type declarations #5918

Closed
pvdstel opened this issue Apr 18, 2024 · 1 comment · Fixed by #5920
Closed

Bug: private module 'shared' is referenced in shipped type declarations #5918

pvdstel opened this issue Apr 18, 2024 · 1 comment · Fixed by #5920

Comments

@pvdstel
Copy link
Contributor

pvdstel commented Apr 18, 2024

Lexical version: 0.14.5, change introduced in 0.14.4 (via #5831).

Steps To Reproduce

  1. Create a new project (pnpm init).
  2. Add the relevant dependencies (pnpm add typescript lexical @lexical/utils).
  3. Add a file index.ts in VSCode with the following contents:
    import { CAN_USE_DOM } from '@lexical/utils';
  4. Navigate to the symbol CAN_USE_DOM. TypeScript will be complaining:
    Cannot find module 'shared/canUseDOM' or its corresponding type declarations.
    
    The same is true for shared/environment.

Screenshot of Visual Studio Code showing the errors in the shipped type definition files

It should be noted that this is merely a TypeScript issue, as the names are exported from the JS bundles.

The current behavior

TypeScript is showing errors since the private module shared cannot be found. This is affecting TypeScript projects that use Lexical 0.14.5.

The expected behavior

The declarations of these variables should not rely on the private package.

@etrepum
Copy link
Contributor

etrepum commented Apr 18, 2024

Confirmed that this only affects the one module:

❯ rg "'shared/" '.ts-temp/'
.ts-temp/lexical-utils/src/index.d.ts
13:export { CAN_USE_DOM } from 'shared/canUseDOM';
14:export { CAN_USE_BEFORE_INPUT, IS_ANDROID, IS_ANDROID_CHROME, IS_APPLE, IS_APPLE_WEBKIT, IS_CHROME, IS_FIREFOX, IS_IOS, IS_SAFARI, } from 'shared/environment';

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