diff --git a/tests/typescript/intersection/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/intersection/__snapshots__/jsfmt.spec.js.snap index 34c9fa1ab..1a258900c 100644 --- a/tests/typescript/intersection/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/intersection/__snapshots__/jsfmt.spec.js.snap @@ -196,3 +196,82 @@ type D6 /*0*/ = /*1*/ a & b; ================================================================================ `; + +exports[`type-arguments.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +// #6988 + +// functional component with ugly linebreak +export const MyLongNamedReactFunctionalComponent1: FunctionComponent = (props) => {} + +// functional component with valid linebreak +export const MyLongNamedReactFunctionalComponent2: FunctionComponent = (props) => {} + +// functional component with valid linebreak +export const MyLongNamedReactFunctionalComponent3: FunctionComponent = (props) => {} + +=====================================output===================================== +// #6988 + +// functional component with ugly linebreak +export const MyLongNamedReactFunctionalComponent1: FunctionComponent< + ALongNamedInterface1 & ALongNamedInterface2 +> = (props) => {} + +// functional component with valid linebreak +export const MyLongNamedReactFunctionalComponent2: FunctionComponent< + ALongNamedInterface1 | ALongNamedInterface2 +> = (props) => {} + +// functional component with valid linebreak +export const MyLongNamedReactFunctionalComponent3: FunctionComponent< + ALongNamedInterface1, + ALongNamedInterface2 +> = (props) => {} + +================================================================================ +`; + +exports[`type-arguments.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +// #6988 + +// functional component with ugly linebreak +export const MyLongNamedReactFunctionalComponent1: FunctionComponent = (props) => {} + +// functional component with valid linebreak +export const MyLongNamedReactFunctionalComponent2: FunctionComponent = (props) => {} + +// functional component with valid linebreak +export const MyLongNamedReactFunctionalComponent3: FunctionComponent = (props) => {} + +=====================================output===================================== +// #6988 + +// functional component with ugly linebreak +export const MyLongNamedReactFunctionalComponent1: FunctionComponent< + ALongNamedInterface1 & ALongNamedInterface2 +> = (props) => {}; + +// functional component with valid linebreak +export const MyLongNamedReactFunctionalComponent2: FunctionComponent< + ALongNamedInterface1 | ALongNamedInterface2 +> = (props) => {}; + +// functional component with valid linebreak +export const MyLongNamedReactFunctionalComponent3: FunctionComponent< + ALongNamedInterface1, + ALongNamedInterface2 +> = (props) => {}; + +================================================================================ +`; diff --git a/tests/typescript/intersection/type-arguments.ts b/tests/typescript/intersection/type-arguments.ts new file mode 100644 index 000000000..4bb831553 --- /dev/null +++ b/tests/typescript/intersection/type-arguments.ts @@ -0,0 +1,10 @@ +// #6988 + +// functional component with ugly linebreak +export const MyLongNamedReactFunctionalComponent1: FunctionComponent = (props) => {} + +// functional component with valid linebreak +export const MyLongNamedReactFunctionalComponent2: FunctionComponent = (props) => {} + +// functional component with valid linebreak +export const MyLongNamedReactFunctionalComponent3: FunctionComponent = (props) => {}