Skip to content

Commit 2232a8c

Browse files
committed
Update gentype_tests
1 parent 2848a80 commit 2232a8c

File tree

6 files changed

+15
-85
lines changed

6 files changed

+15
-85
lines changed

tests/gentype_tests/typescript-react-example/src/ExportWithRename.gen.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@
55

66
import * as ExportWithRenameJS from './ExportWithRename.res.js';
77

8-
export type props<s> = { readonly s: s };
9-
10-
export const Renamed: React.ComponentType<{ readonly s: string }> = ExportWithRenameJS.make as any;
8+
export const Renamed: (s:string) => JSX.Element = ExportWithRenameJS.make as any;

tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,19 @@ import {default as makeNotChecked} from './hookExample';
88
import {default as defaultNotChecked} from './hookExample';
99

1010
// In case of type error, check the type of 'make' in 'ImportHookDefault.res' and './hookExample'.
11-
export const makeTypeChecked: React.ComponentType<{
12-
readonly person: person;
13-
readonly children: React.ReactNode;
14-
readonly renderMe: ImportHooks_renderMe<string>
15-
}> = makeNotChecked as any;
11+
export const makeTypeChecked: (person:person, children:JSX.Element, renderMe:ImportHooks_renderMe<string>) => JSX.Element = makeNotChecked as any;
1612

1713
// Export 'make' early to allow circular import from the '.bs.js' file.
18-
export const make: unknown = makeTypeChecked as React.ComponentType<{
19-
readonly person: person;
20-
readonly children: React.ReactNode;
21-
readonly renderMe: ImportHooks_renderMe<string>
22-
}> as any;
14+
export const make: unknown = makeTypeChecked as (person:person, children:JSX.Element, renderMe:ImportHooks_renderMe<string>) => JSX.Element as any;
2315

2416
// In case of type error, check the type of 'default' in 'ImportHookDefault.res' and './hookExample'.
25-
export const defaultTypeChecked: React.ComponentType<{
26-
readonly person: person;
27-
readonly children: React.ReactNode;
28-
readonly renderMe: ImportHooks_renderMe<string>
29-
}> = defaultNotChecked as any;
17+
export const defaultTypeChecked: (person:person, children:JSX.Element, renderMe:ImportHooks_renderMe<string>) => JSX.Element = defaultNotChecked as any;
3018

3119
// Export '$$default' early to allow circular import from the '.bs.js' file.
32-
export const $$default: unknown = defaultTypeChecked as React.ComponentType<{
33-
readonly person: person;
34-
readonly children: React.ReactNode;
35-
readonly renderMe: ImportHooks_renderMe<string>
36-
}> as any;
20+
export const $$default: unknown = defaultTypeChecked as (person:person, children:JSX.Element, renderMe:ImportHooks_renderMe<string>) => JSX.Element as any;
3721

3822
import type {renderMe as ImportHooks_renderMe} from './ImportHooks.gen';
3923

4024
export type person = { readonly name: string; readonly age: number };
4125

42-
export type props<person,children,renderMe> = {
43-
readonly person: person;
44-
readonly children: children;
45-
readonly renderMe: renderMe
46-
};
47-
48-
export type MM_props<person,children,renderMe> = {
49-
readonly person: person;
50-
readonly children: children;
51-
readonly renderMe: renderMe
52-
};
53-
5426
export default $$default;

tests/gentype_tests/typescript-react-example/src/ImportHooks.gen.tsx

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,10 @@ import {makeRenamed as makeRenamedNotChecked} from './hookExample';
88
import {foo as fooNotChecked} from './hookExample';
99

1010
// In case of type error, check the type of 'makeRenamed' in 'ImportHooks.res' and './hookExample'.
11-
export const makeRenamedTypeChecked: React.ComponentType<{
12-
readonly actions?: JSX.Element;
13-
readonly person: person;
14-
readonly children: React.ReactNode;
15-
readonly renderMe: renderMe<any>
16-
}> = makeRenamedNotChecked as any;
11+
export const makeRenamedTypeChecked: <a>(actions:JSX.Element, person:person, children:JSX.Element, renderMe:renderMe<a>) => JSX.Element = makeRenamedNotChecked as any;
1712

1813
// Export 'makeRenamed' early to allow circular import from the '.bs.js' file.
19-
export const makeRenamed: unknown = makeRenamedTypeChecked as React.ComponentType<{
20-
readonly actions?: JSX.Element;
21-
readonly person: person;
22-
readonly children: React.ReactNode;
23-
readonly renderMe: renderMe<any>
24-
}> as any;
14+
export const makeRenamed: unknown = makeRenamedTypeChecked as <a>(actions:JSX.Element, person:person, children:JSX.Element, renderMe:renderMe<a>) => JSX.Element as any;
2515

2616
// In case of type error, check the type of 'foo' in 'ImportHooks.res' and './hookExample'.
2717
export const fooTypeChecked: (person:person) => string = fooNotChecked as any;
@@ -32,10 +22,3 @@ export const foo: unknown = fooTypeChecked as (person:person) => string as any;
3222
export type person = { readonly name: string; readonly age: number };
3323

3424
export type renderMe<a> = React.ComponentType<{ readonly randomString: string; readonly poly: a }>;
35-
36-
export type props<actions,person,children,renderMe> = {
37-
readonly actions?: actions;
38-
readonly person: person;
39-
readonly children: children;
40-
readonly renderMe: renderMe
41-
};

tests/gentype_tests/typescript-react-example/src/ImportIndex.gen.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
import {default as defaultNotChecked} from './';
77

88
// In case of type error, check the type of 'default' in 'ImportIndex.res' and './'.
9-
export const defaultTypeChecked: React.ComponentType<{ readonly method?: "push" | "replace" }> = defaultNotChecked as any;
9+
export const defaultTypeChecked: (method:"push" | "replace") => JSX.Element = defaultNotChecked as any;
1010

1111
// Export '$$default' early to allow circular import from the '.bs.js' file.
12-
export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly method?: "push" | "replace" }> as any;
13-
14-
export type props<method> = { readonly method?: method };
12+
export const $$default: unknown = defaultTypeChecked as (method:"push" | "replace") => JSX.Element as any;
1513

1614
export default $$default;

tests/gentype_tests/typescript-react-example/src/JSXV4.gen.tsx

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,19 @@
66
import {make as makeNotChecked} from './hookExample';
77

88
// In case of type error, check the type of 'make' in 'JSXV4.res' and './hookExample'.
9-
export const makeTypeChecked: React.ComponentType<{
10-
readonly actions?: JSX.Element;
11-
readonly person: person;
12-
readonly children: React.ReactNode;
13-
readonly renderMe: renderMe<any>
14-
}> = makeNotChecked as any;
9+
export const makeTypeChecked: <a>(actions:JSX.Element, person:person, children:JSX.Element, renderMe:renderMe<a>) => JSX.Element = makeNotChecked as any;
1510

1611
// Export 'make' early to allow circular import from the '.bs.js' file.
17-
export const make: unknown = makeTypeChecked as React.ComponentType<{
18-
readonly actions?: JSX.Element;
19-
readonly person: person;
20-
readonly children: React.ReactNode;
21-
readonly renderMe: renderMe<any>
22-
}> as any;
12+
export const make: unknown = makeTypeChecked as <a>(actions:JSX.Element, person:person, children:JSX.Element, renderMe:renderMe<a>) => JSX.Element as any;
2313

2414
const JSXV4JS = require('./JSXV4.res.js');
2515

26-
export type CompV4_props<x,y> = { readonly x: x; readonly y: y };
27-
2816
export type person = { readonly name: string; readonly age: number };
2917

3018
export type props2<a> = { readonly randomString: string; readonly poly: a };
3119

3220
export type renderMe<a> = (_1:props2<a>) => JSX.Element;
3321

34-
export type props<actions,person,children,renderMe> = {
35-
readonly actions?: actions;
36-
readonly person: person;
37-
readonly children: children;
38-
readonly renderMe: renderMe
39-
};
40-
41-
export const CompV4_make: React.ComponentType<{ readonly x: string; readonly y: string }> = JSXV4JS.CompV4.make as any;
22+
export const CompV4_make: (x:string, y:string) => JSX.Element = JSXV4JS.CompV4.make as any;
4223

43-
export const CompV4: { make: React.ComponentType<{ readonly x: string; readonly y: string }> } = JSXV4JS.CompV4 as any;
24+
export const CompV4: { make: (x:string, y:string) => JSX.Element } = JSXV4JS.CompV4 as any;

tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
import {default as defaultNotChecked} from './MyInput';
77

88
// In case of type error, check the type of 'default' in 'MyInput.res' and './MyInput'.
9-
export const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> = defaultNotChecked as any;
9+
export const defaultTypeChecked: (onFocus:((_1:inputFocusEvent) => void)) => JSX.Element = defaultNotChecked as any;
1010

1111
// Export '$$default' early to allow circular import from the '.bs.js' file.
12-
export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> as any;
12+
export const $$default: unknown = defaultTypeChecked as (onFocus:((_1:inputFocusEvent) => void)) => JSX.Element as any;
1313

1414
import type {inputFocusEvent as $$inputFocusEvent} from './shims/JsxEvent.shim';
1515

1616
export type inputFocusEvent = $$inputFocusEvent;
1717

18-
export type props<onFocus> = { readonly onFocus?: onFocus };
19-
2018
export default $$default;

0 commit comments

Comments
 (0)