Upgrade dependencies to fix @lezer/highlight declaration file #7

Closed
anthologen wants to merge 2 commits from ts_highlight_build_issue into main
anthologen commented 2024-01-08 05:31:50 +01:00 (Migrated from github.com)

Using "moduleResolution": "bundler", I am encountering the Typescript issue https://github.com/lezer-parser/highlight/issues/3

node_modules/@codemirror/language/dist/index.d.ts:6:34 - error TS7016: Could not find a declaration file for module '@lezer/highlight'. '/node_modules/@lezer/highlight/dist/index.js' implicitly has an 'any' type.
  There are types at '/node_modules/@lezer/highlight/dist/highlight.d.ts', but this result could not be resolved when respecting package.json "exports". The '@lezer/highlight' library may need to update its package.json or typings.

6 import { Highlighter, Tag } from '@lezer/highlight';
                                   ~~~~~~~~~~~~~~~~~~

Despite the error message suggesting '@lezer/highlight' needs fixing, this issue exists here because this project depends on @lezer-parser/highlight v1.0.0 when the fix is available in @lezer-parser/highlight v1.1.4. Like the resolution of https://github.com/lezer-parser/highlight/pull/10#issuecomment-1781798718, the solution is to upgrade to @lezer-parser/highlight >= v1.1.4

I can confirm this resolves my issue by adding the following override to my package.json:

  "overrides": {
    "@codemirror/language": {
      "@lezer/highlight": "1.1.4"
    }
  }

While I was at it, I thought I'd also bump the other package versions to latest too. Only minor version upgrades were made.

Using `"moduleResolution": "bundler"`, I am encountering the Typescript issue https://github.com/lezer-parser/highlight/issues/3 ``` node_modules/@codemirror/language/dist/index.d.ts:6:34 - error TS7016: Could not find a declaration file for module '@lezer/highlight'. '/node_modules/@lezer/highlight/dist/index.js' implicitly has an 'any' type. There are types at '/node_modules/@lezer/highlight/dist/highlight.d.ts', but this result could not be resolved when respecting package.json "exports". The '@lezer/highlight' library may need to update its package.json or typings. 6 import { Highlighter, Tag } from '@lezer/highlight'; ~~~~~~~~~~~~~~~~~~ ``` Despite the error message suggesting '@lezer/highlight' needs fixing, this issue exists here because this project depends on @lezer-parser/highlight **v1.0.0** when [the fix](https://github.com/lezer-parser/highlight/issues/3#issuecomment-1482398494) is available in @lezer-parser/highlight **v1.1.4**. Like the resolution of https://github.com/lezer-parser/highlight/pull/10#issuecomment-1781798718, the solution is to upgrade to @lezer-parser/highlight >= v1.1.4 I can confirm this resolves my issue by adding the following override to my `package.json`: ``` "overrides": { "@codemirror/language": { "@lezer/highlight": "1.1.4" } } ``` While I was at it, I thought I'd also bump the other package versions to latest too. Only minor version upgrades were made.
marijnh commented 2024-01-08 11:08:56 +01:00 (Migrated from github.com)

I'm not tracking latest versions of dependencies in my packages unless they directly rely on some new feature in those dependencies. To solve this, just clear your own local package lock to get rid of the old version.

I'm not tracking latest versions of dependencies in my packages unless they directly rely on some new feature in those dependencies. To solve this, just clear your own local package lock to get rid of the old version.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/language!7
No description provided.