Files
test-repo/tests/format/flow/component/declare-component.js
T
Sam Zhou ae8dcc48f5 Component syntax and related language features printing support (#16191)
* Component syntax and related language features printing support

Relevant Flow docs:
- https://flow.org/en/docs/react/component-syntax/
- https://flow.org/en/docs/react/render-types/

* Update issue number

* declare new test as unstable

* fix tests
2024-04-04 23:10:00 +09:00

45 lines
1.3 KiB
JavaScript

declare component MyComponent();
declare component MyComponent() renders SomeComponent;
declare component MyComponent() renders React.Element<typeof SomeComponentLonnnnnnnnnnnnnnnnnnnnnnnnnnnnng>;
declare component MyComponent<T>();
declare component MyComponent<T: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo>();
declare component MyComponent(bar: string);
declare component MyComponent(bar?: string);
declare component MyComponent('data-bar': string);
declare component MyComponent(...restProps: $ReadOnly<{k: string}>);
declare component MyComponent(...$ReadOnly<{k: string}>);
declare component MyComponent(bar: string, baz: $ReadOnly<{k: string}>);
declare component MyComponent(bar: string, baz: $ReadOnly<{k: string}>, realllllllllllllllllllyLong: string);
// Attached comment
declare component MyComponent(
/**
* Commet block
*/
bar: string, // Trailing comment
// preceding comment
'data-baz': $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
// Trailing comment
);
declare component MyComponent(
...props: $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
// Trailing comment
);
declare component MyComponent(
...props: $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
// Trailing comment
) renders SomeComponent;