Description
HI,
I'm upgrading a codebase from 3.5.3 to 3.8.3 and found this error, tsc does not produce any error on this file, but the declaration file emitted is broken and can not be consumed by another tsc compilation.
providing your confirmation (and maybe some direction) I'd be happy to file a PR myself.
Thanks
Nadav Sinai - Tech lead.
Philips-Algotec
TypeScript Version: 3.8.3
notice this is a regression - Typescript 3.7 produces the correct code.
Search Terms:
I searched issues & SO for :
"declaration parse error quotes "
"TS1131" && "TS1131: Property or signature expected" (loads of irreverent stuff)
"ts1131 property or signature expected. quotes removed .d.ts"
Expected behavior:
Quotes should be retained.
Actual behavior:
Quotes are removed, broken declaration file is produced which is unparsable by tsc
Related Issues:
no
Code
export enum MouseButton {
LEFT_BUTTON = 1,
RIGHT_BUTTON = 2,
MIDDLE_BUTTON = 4,
XBUTTON1_BUTTON = 5,
XBUTTON2_BUTTON = 6,
NO_BUTTON = 0,
}
// tslint:disable-next-line:variable-name
export const DOMMouseButton = {
'-1': MouseButton.NO_BUTTON,
"0": MouseButton.LEFT_BUTTON,
"1": MouseButton.MIDDLE_BUTTON,
"2": MouseButton.RIGHT_BUTTON,
"3": MouseButton.XBUTTON1_BUTTON,
"4": MouseButton.XBUTTON2_BUTTON,
};
Declaration Output
export declare enum MouseButton {
LEFT_BUTTON = 1,
RIGHT_BUTTON = 2,
MIDDLE_BUTTON = 4,
XBUTTON1_BUTTON = 5,
XBUTTON2_BUTTON = 6,
NO_BUTTON = 0
}
export declare const DOMMouseButton: {
-1: MouseButton;
0: MouseButton;
1: MouseButton;
2: MouseButton;
3: MouseButton;
4: MouseButton;
};
Compiler Options
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"alwaysStrict": true,
"esModuleInterop": true,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": 2,
"target": "ES2017",
"jsx": "React",
"module": "ESNext"
}
}
Playground Link: Provided