Skip to content

Commit

Permalink
fix(noUndeclaredVariables): bind read in ambient context to import type
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos committed Nov 15, 2024
1 parent b945258 commit 4b1e836
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 62 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,19 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

Contributed by @Conaclos

- [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) is now able to bind read of value to a type-only import in ambient contexts ([#4526](https://github.com/biomejs/biome/issues/4526)).

In the following code, `A` is now correctly bound to the type-only import.
Previously, `A` was reported as an undeclared variable.

```ts
import type { A } from "mod";

declare class B extends A {}
```

Contributed by @Conaclos

### Parser

#### Bug fixes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { TransformStream as TransformWebStream } from "node:stream/web";

export class TextLineStream extends TransformWebStream<string, string> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
source: crates/biome_js_analyze/tests/spec_tests.rs
expression: validAmbientRead.d.ts
snapshot_kind: text
---
# Input
```ts
import type { TransformStream as TransformWebStream } from "node:stream/web";

export class TextLineStream extends TransformWebStream<string, string> {}

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { TransformStream as TransformWebStream } from "node:stream/web";

export declare class TextLineStream extends TransformWebStream<string, string> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
source: crates/biome_js_analyze/tests/spec_tests.rs
expression: validAmbientRead.ts
snapshot_kind: text
---
# Input
```ts
import type { TransformStream as TransformWebStream } from "node:stream/web";

export declare class TextLineStream extends TransformWebStream<string, string> {}

```
Loading

0 comments on commit 4b1e836

Please sign in to comment.