fix: use BABEL_8_BREAKING for new babel-types breaking changes (#13538)
This commit is contained in:
parent
79d3276f61
commit
234316161f
@ -566,7 +566,7 @@ defineType("TSTypeParameter", {
|
||||
visitor: ["constraint", "default"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: !process.env.BABEL_TYPES_8_BREAKING
|
||||
validate: !process.env.BABEL_8_BREAKING
|
||||
? assertValueType("string")
|
||||
: assertNodeType("Identifier"),
|
||||
},
|
||||
|
||||
@ -7,7 +7,7 @@ describe("builders", function () {
|
||||
const tsTypeParameter = t.tsTypeParameter(
|
||||
t.tsTypeReference(t.identifier("bar")),
|
||||
t.tsTypeReference(t.identifier("baz")),
|
||||
!process.env.BABEL_TYPES_8_BREAKING ? "foo" : t.identifier("foo"),
|
||||
!process.env.BABEL_8_BREAKING ? "foo" : t.identifier("foo"),
|
||||
);
|
||||
expect(tsTypeParameter).toMatchSnapshot({
|
||||
name: expect.anything(),
|
||||
@ -15,7 +15,7 @@ describe("builders", function () {
|
||||
// TODO(babel-8): move this check to the snapshot
|
||||
expect(tsTypeParameter).toEqual(
|
||||
expect.objectContaining({
|
||||
name: !process.env.BABEL_TYPES_8_BREAKING
|
||||
name: !process.env.BABEL_8_BREAKING
|
||||
? "foo"
|
||||
: expect.objectContaining({
|
||||
name: "foo",
|
||||
@ -31,7 +31,7 @@ describe("builders", function () {
|
||||
t.tsTypeReference(t.identifier("baz")),
|
||||
);
|
||||
}).toThrow(
|
||||
!process.env.BABEL_TYPES_8_BREAKING
|
||||
!process.env.BABEL_8_BREAKING
|
||||
? "Property name expected type of string but got null"
|
||||
: 'Property name of TSTypeParameter expected node to be of a type ["Identifier"] but instead got undefined',
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user