mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
//// [tests/cases/compiler/declarationEmitPrivateNameCausesError.ts] ////
|
|
|
|
//// [file.ts]
|
|
const IGNORE_EXTRA_VARIABLES = Symbol(); //Notice how this is unexported
|
|
|
|
//This is exported
|
|
export function ignoreExtraVariables<CtorT extends {new(...args:any[]):{}}> (ctor : CtorT) {
|
|
return class extends ctor {
|
|
[IGNORE_EXTRA_VARIABLES] = true; //An unexported constant is used
|
|
};
|
|
}
|
|
|
|
//// [file.js]
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.ignoreExtraVariables = ignoreExtraVariables;
|
|
const IGNORE_EXTRA_VARIABLES = Symbol(); //Notice how this is unexported
|
|
//This is exported
|
|
function ignoreExtraVariables(ctor) {
|
|
var _a, _b;
|
|
return _b = class extends ctor {
|
|
constructor() {
|
|
super(...arguments);
|
|
this[_a] = true; //An unexported constant is used
|
|
}
|
|
},
|
|
_a = IGNORE_EXTRA_VARIABLES,
|
|
_b;
|
|
}
|
|
|
|
|
|
//// [file.d.ts]
|
|
declare const IGNORE_EXTRA_VARIABLES: unique symbol;
|
|
export declare function ignoreExtraVariables<CtorT extends {
|
|
new (...args: any[]): {};
|
|
}>(ctor: CtorT): {
|
|
new (...args: any[]): {
|
|
[IGNORE_EXTRA_VARIABLES]: boolean;
|
|
};
|
|
} & CtorT;
|
|
export {};
|