mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-05 21:23:37 -05:00
Fixes for decorators property deprecations (#50343)
* Change type of deprecated 'decorators' property * fix 'Invalid Arguments' error for create/update constructor in factory * Update deprecation comments * Make 'decorators' optional and 'undefined' * Rename '_decorators' to 'illegalDecorators' * Update baselines
This commit is contained in:
@@ -81,5 +81,40 @@ namespace ts {
|
||||
checkRhs(SyntaxKind.QuestionQuestionEqualsToken, /*expectParens*/ false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("deprecations", () => {
|
||||
beforeEach(() => {
|
||||
Debug.enableDeprecationWarnings = false;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
Debug.enableDeprecationWarnings = true;
|
||||
});
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/50259
|
||||
it("deprecated createConstructorDeclaration overload does not throw", () => {
|
||||
const body = factory.createBlock([]);
|
||||
assert.doesNotThrow(() => factory.createConstructorDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined,
|
||||
/*parameters*/ [],
|
||||
body,
|
||||
));
|
||||
});
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/50259
|
||||
it("deprecated updateConstructorDeclaration overload does not throw", () => {
|
||||
const body = factory.createBlock([]);
|
||||
const ctor = factory.createConstructorDeclaration(/*modifiers*/ undefined, [], body);
|
||||
assert.doesNotThrow(() => factory.updateConstructorDeclaration(
|
||||
ctor,
|
||||
ctor.decorators,
|
||||
ctor.modifiers,
|
||||
ctor.parameters,
|
||||
ctor.body,
|
||||
));
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user