-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathmodern.test.ts
More file actions
34 lines (31 loc) · 1.3 KB
/
Copy pathmodern.test.ts
File metadata and controls
34 lines (31 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import * as prettier from "prettier";
import { AllOptions } from "../src/types";
function subject(code: string, options: Partial<AllOptions> = {}) {
return prettier.format(code, {
plugins: ["prettier-plugin-jsdoc"],
parser: "typescript",
jsdocSpaces: 1,
...options,
} as AllOptions);
}
test("convert array to modern type", async () => {
const result = await subject(`
/**
* @typedef {import("react-native-reanimated").default.Adaptable<number>} Adaptable
* @param {Adaptable} animNode
* @param {object} InterpolationConfig
* @param {ReadonlyArray<Adaptable>} InterpolationConfig.inputRange Like [0,1]
* @param {Array<string>} InterpolationConfig.outputRange Like ["#0000ff","#ff0000"]
* @param {import("react-native-reanimated").default.Extrapolate} [InterpolationConfig.extrapolate]
* @param {Array<Foo<Bar>>} arg1
* @param {Array<(item: Foo<Bar>) => Bar<number>> | Array<number> | Array<string>} arg2
* @param {Array.<(item: Foo.<Bar>) => Bar.<number>> | Array.<number> | Array.<'Foo.<>'>} arg3
* @param {"Array.<(item: Foo.<Bar>) => Bar.<number>> | Array.<number> | Array.<'Foo.<>'>"} arg4
* @param {Array<Array<Array<number>>>} arg5
* @param {{ foo: Array<number>; bar: Array<string> }} arg6
*
*/
function a(){}
`);
expect(result).toMatchSnapshot();
});