File: typeofImportInstantiationExpression.js

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (28 lines) | stat: -rw-r--r-- 808 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//// [tests/cases/compiler/typeofImportInstantiationExpression.ts] ////

//// [input.ts]
// @strict

// Repro from #52248

interface Arg<T = any, Params extends Record<string, any> = Record<string, any>> {
    "__is_argument__"?: true;
    meta?: T;
    params?: Params;
}

export function myFunction<T = any, U extends Record<string, any> = Record<string, any>>(arg: Arg<T, U>) { return (arg.params || {}) as U }

//// [main.ts]
type T1 = typeof import('./input.js').myFunction;
type T2 = typeof import('./input.js').myFunction<any, { slug: 'hello' }>;


//// [input.js]
"use strict";
// @strict
Object.defineProperty(exports, "__esModule", { value: true });
exports.myFunction = void 0;
function myFunction(arg) { return (arg.params || {}); }
exports.myFunction = myFunction;
//// [main.js]