Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tarasyuk committed Jan 19, 2025
1 parent 9f439bb commit 58f9d2f
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/baselines/reference/importTag25.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//// [tests/cases/conformance/jsdoc/importTag25.ts] ////

=== types.d.ts ===
export type T = {
>T : Symbol(T, Decl(types.d.ts, 0, 0))

a: number;
>a : Symbol(a, Decl(types.d.ts, 0, 17))

};

=== foo.js ===
/** @import { T } from "./types.d.ts" */

export default async function f() {
>f : Symbol(f, Decl(foo.js, 0, 0))

/** @type {T[]} */
const types = [];
>types : Symbol(types, Decl(foo.js, 4, 6))

return types;
>types : Symbol(types, Decl(foo.js, 4, 6))
}

32 changes: 32 additions & 0 deletions tests/baselines/reference/importTag25.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//// [tests/cases/conformance/jsdoc/importTag25.ts] ////

=== types.d.ts ===
export type T = {
>T : T
> : ^

a: number;
>a : number
> : ^^^^^^

};

=== foo.js ===
/** @import { T } from "./types.d.ts" */

export default async function f() {
>f : () => Promise<T[]>
> : ^^^^^^^^^^^^^^^^^^

/** @type {T[]} */
const types = [];
>types : T[]
> : ^^^
>[] : undefined[]
> : ^^^^^^^^^^^

return types;
>types : T[]
> : ^^^
}

18 changes: 18 additions & 0 deletions tests/cases/conformance/jsdoc/importTag25.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// @noUnusedLocals: true
// @allowJs: true
// @checkJs: true
// @noEmit: true

// @filename: types.d.ts
export type T = {
a: number;
};

// @filename: foo.js
/** @import { T } from "./types.d.ts" */

export default async function f() {
/** @type {T[]} */
const types = [];
return types;
}

0 comments on commit 58f9d2f

Please sign in to comment.