mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 03:09:39 -06:00
Fix declaration emit of divergent accessors in JS classes (#58172)
This commit is contained in:
parent
4b01686602
commit
be1f89271c
@ -9853,7 +9853,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
/*dotDotDotToken*/ undefined,
|
||||
paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
|
||||
/*questionToken*/ undefined,
|
||||
isPrivate ? undefined : serializeTypeForDeclaration(context, /*declaration*/ undefined, getTypeOfSymbol(p), p),
|
||||
isPrivate ? undefined : serializeTypeForDeclaration(context, /*declaration*/ undefined, getWriteTypeOfSymbol(p), p),
|
||||
)],
|
||||
/*body*/ undefined,
|
||||
),
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
//// [tests/cases/compiler/declarationEmitClassAccessorsJs1.ts] ////
|
||||
|
||||
//// [index.js]
|
||||
// https://github.com/microsoft/TypeScript/issues/58167
|
||||
|
||||
export class VFile {
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
get path() {
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {URL | string} path
|
||||
*/
|
||||
set path(path) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//// [index.d.ts]
|
||||
export class VFile {
|
||||
/**
|
||||
* @param {URL | string} path
|
||||
*/
|
||||
set path(path: string | URL);
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
get path(): string;
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
//// [tests/cases/compiler/declarationEmitClassAccessorsJs1.ts] ////
|
||||
|
||||
=== index.js ===
|
||||
// https://github.com/microsoft/TypeScript/issues/58167
|
||||
|
||||
export class VFile {
|
||||
>VFile : Symbol(VFile, Decl(index.js, 0, 0))
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
get path() {
|
||||
>path : Symbol(VFile.path, Decl(index.js, 2, 20), Decl(index.js, 8, 3))
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {URL | string} path
|
||||
*/
|
||||
set path(path) {
|
||||
>path : Symbol(VFile.path, Decl(index.js, 2, 20), Decl(index.js, 8, 3))
|
||||
>path : Symbol(path, Decl(index.js, 13, 11))
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
//// [tests/cases/compiler/declarationEmitClassAccessorsJs1.ts] ////
|
||||
|
||||
=== index.js ===
|
||||
// https://github.com/microsoft/TypeScript/issues/58167
|
||||
|
||||
export class VFile {
|
||||
>VFile : VFile
|
||||
> : ^^^^^
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
get path() {
|
||||
>path : string
|
||||
> : ^^^^^^
|
||||
|
||||
return ''
|
||||
>'' : ""
|
||||
> : ^^
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {URL | string} path
|
||||
*/
|
||||
set path(path) {
|
||||
>path : string
|
||||
> : ^^^^^^
|
||||
>path : string | URL
|
||||
> : ^^^^^^^^^^^^
|
||||
}
|
||||
}
|
||||
|
||||
22
tests/cases/compiler/declarationEmitClassAccessorsJs1.ts
Normal file
22
tests/cases/compiler/declarationEmitClassAccessorsJs1.ts
Normal file
@ -0,0 +1,22 @@
|
||||
// @strict: true
|
||||
// @checkJs: true
|
||||
// @declaration: true
|
||||
// @emitDeclarationOnly: true
|
||||
// @filename: index.js
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/58167
|
||||
|
||||
export class VFile {
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
get path() {
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {URL | string} path
|
||||
*/
|
||||
set path(path) {
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user