Files
tsgo/testdata/baselines/reference/tsc/declarationEmit/reports-dts-generation-errors.js

175 lines
5.9 KiB
TypeScript

currentDirectory::/home/src/workspaces/project
useCaseSensitiveFileNames::true
Input::
//// [/home/src/workspaces/project/index.ts] *new*
import ky from 'ky';
export const api = ky.extend({});
//// [/home/src/workspaces/project/node_modules/ky/distribution/index.d.ts] *new*
type KyInstance = {
extend(options: Record<string,unknown>): KyInstance;
}
declare const ky: KyInstance;
export default ky;
//// [/home/src/workspaces/project/node_modules/ky/package.json] *new*
{
"name": "ky",
"type": "module",
"main": "./distribution/index.js"
}
//// [/home/src/workspaces/project/package.json] *new*
{
"type": "module"
}
//// [/home/src/workspaces/project/tsconfig.json] *new*
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"composite": false,
"incremental": false,
"declaration": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
},
}
tsgo --explainFiles --listEmittedFiles
ExitStatus:: DiagnosticsPresent_OutputsSkipped
Output::
index.ts:2:14 - error TS4023: Exported variable 'api' has or is using name 'KyInstance' from external module "/home/src/workspaces/project/node_modules/ky/distribution/index" but cannot be named.
2 export const api = ky.extend({});
   ~~~
TSFILE: /home/src/workspaces/project/index.js
../../tslibs/TS/Lib/lib.es2025.full.d.ts
Default library for target 'ES2025'
node_modules/ky/distribution/index.d.ts
Imported via 'ky' from file 'index.ts'
File is ECMAScript module because 'node_modules/ky/package.json' has field "type" with value "module"
index.ts
Matched by default include pattern '**/*'
File is ECMAScript module because 'package.json' has field "type" with value "module"
Found 1 error in index.ts:2
//// [/home/src/tslibs/TS/Lib/lib.es2025.full.d.ts] *Lib*
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }
interface ReadonlyArray<T> {}
interface SymbolConstructor {
(desc?: string | number): symbol;
for(name: string): symbol;
readonly toStringTag: symbol;
}
declare var Symbol: SymbolConstructor;
interface Symbol {
readonly [Symbol.toStringTag]: string;
}
declare const console: { log(msg: any): void; };
//// [/home/src/workspaces/project/index.js] *new*
import ky from 'ky';
export const api = ky.extend({});
Edit [0]:: no change
tsgo --explainFiles --listEmittedFiles
ExitStatus:: DiagnosticsPresent_OutputsSkipped
Output::
index.ts:2:14 - error TS4023: Exported variable 'api' has or is using name 'KyInstance' from external module "/home/src/workspaces/project/node_modules/ky/distribution/index" but cannot be named.
2 export const api = ky.extend({});
   ~~~
TSFILE: /home/src/workspaces/project/index.js
../../tslibs/TS/Lib/lib.es2025.full.d.ts
Default library for target 'ES2025'
node_modules/ky/distribution/index.d.ts
Imported via 'ky' from file 'index.ts'
File is ECMAScript module because 'node_modules/ky/package.json' has field "type" with value "module"
index.ts
Matched by default include pattern '**/*'
File is ECMAScript module because 'package.json' has field "type" with value "module"
Found 1 error in index.ts:2
//// [/home/src/workspaces/project/index.js] *rewrite with same content*
Edit [1]:: build -b
tsgo -b --explainFiles --listEmittedFiles --v
ExitStatus:: DiagnosticsPresent_OutputsSkipped
Output::
[HH:MM:SS AM] Projects in this build:
* tsconfig.json
[HH:MM:SS AM] Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
[HH:MM:SS AM] Building project 'tsconfig.json'...
index.ts:2:14 - error TS4023: Exported variable 'api' has or is using name 'KyInstance' from external module "/home/src/workspaces/project/node_modules/ky/distribution/index" but cannot be named.
2 export const api = ky.extend({});
   ~~~
TSFILE: /home/src/workspaces/project/index.js
TSFILE: /home/src/workspaces/project/tsconfig.tsbuildinfo
../../tslibs/TS/Lib/lib.es2025.full.d.ts
Default library for target 'ES2025'
node_modules/ky/distribution/index.d.ts
Imported via 'ky' from file 'index.ts'
File is ECMAScript module because 'node_modules/ky/package.json' has field "type" with value "module"
index.ts
Matched by default include pattern '**/*'
File is ECMAScript module because 'package.json' has field "type" with value "module"
[HH:MM:SS AM] Updating unchanged output timestamps of project 'tsconfig.json'...
Found 1 error in index.ts:2
//// [/home/src/workspaces/project/index.js] *rewrite with same content*
//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new*
{"version":"FakeTSVersion","errors":true,"root":["./index.ts"],"packageJsons":["./node_modules/ky/package.json","./package.json"],"missingPackageJsons":["./node_modules/ky/distribution/package.json"]}
//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new*
{
"version": "FakeTSVersion",
"errors": true,
"root": [
{
"files": [
"./index.ts"
],
"original": "./index.ts"
}
],
"packageJsons": [
"./node_modules/ky/package.json",
"./package.json"
],
"missingPackageJsons": [
"./node_modules/ky/distribution/package.json"
],
"size": 200
}
tsconfig.json::
SemanticDiagnostics::
*refresh* /home/src/tslibs/TS/Lib/lib.es2025.full.d.ts
*refresh* /home/src/workspaces/project/node_modules/ky/distribution/index.d.ts
*refresh* /home/src/workspaces/project/index.ts
Signatures::