add TSIntersectionType (#1395)
* add TSIntersectionType * use same print implementation for flow and typescript
This commit is contained in:
1 parent
5f5566e4ef
commit
6f0cc31fdb
4 files changed
+24
No files matched your search
@@ -1705,6 +1705,7 @@ function genericPrintNoParens(path, options, print, args) {
|
||||
path.call(print, "id"),
|
||||
path.call(print, "typeParameters")
|
||||
]);
|
||||
case "TSIntersectionType":
|
||||
case "IntersectionTypeAnnotation": {
|
||||
const types = path.map(print, "types");
|
||||
const result = [];
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`intersectionType.ts 1`] = `
|
||||
type A = & string;
|
||||
type B =
|
||||
& { foo: string }
|
||||
& { bar: number };
|
||||
|
||||
type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
type A = string;
|
||||
type B = { foo: string } & { bar: number };
|
||||
|
||||
type C = [{ foo: 1 } & { bar: 2 }, { foo: 3 } & { bar: 4 }];
|
||||
|
||||
`;
|
||||
@@ -0,0 +1,6 @@
|
||||
type A = & string;
|
||||
type B =
|
||||
& { foo: string }
|
||||
& { bar: number };
|
||||
|
||||
type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }];
|
||||
@@ -0,0 +1 @@
|
||||
run_spec(__dirname, { parser: "typescript" });
|
||||
Reference in new issue
Block a user