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:
Ron Buckton authored and GitHub committed 2022-08-19 14:27:26 -04:00
1 parent ef88fbb8ab
commit 284837d66b
11 files changed
+301 -440

No files matched your search

+35
View File
@@ -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,
));
});
});
});
}