Skip to content

[Bug][2.0]: Types is not working with "moduleResolution": "node16" #2114

@colinaaa

Description

@colinaaa

Version

System:
    OS: macOS 14.6.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 3.39 GB / 96.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 135.0.7049.115
    Safari: 17.6
  npmPackages:
    @rspress/plugin-client-redirects: 2.0.0-beta.3 => 2.0.0-beta.3 
    @rspress/shared: 2.0.0-beta.3 => 2.0.0-beta.3 
    rspress: 2.0.0-beta.3 => 2.0.0-beta.3

Details

We are using "moduleResolution": "node16". And the types is not working now.

I think it's caused by #2084.

Currently, @rspress/runtime/dist/index.d.ts has:

export { DataContext, ThemeContext, useDark, useI18n, useLang, usePageData, useVersion, useViewTransition, useWindowSize, } from './hooks';

which cause ./hooks cannot be resolved by TypeScript.

You may also see the result at https://arethetypeswrong.github.io/?p=%40rspress%2Fruntime%402.0.0-beta.3

Reproduce link

https://github.com/lynx-family/lynx-stack/blob/4afa94e3d1cf11e0654a67a6a6ab0a92f3f688a9/website/theme/HomeLayout/index.tsx#L13

Reproduce Steps

  1. Run pnpm install
  2. See the TS/ESLint error in website/theme/HomeLayout/index.tsx`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions