From 458852ff2a6399838cd86c6ca7aa939c7bfaf068 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Fri, 5 Sep 2025 21:44:35 +0200 Subject: [PATCH 01/10] exploration for --- Makefile | 2 + compiler/gentype/EmitJs.ml | 48 ++++++++++++++- compiler/gentype/GentypeImportHelper.ml | 3 + compiler/gentype/GentypeTypeFold.ml | 19 ++++++ compiler/gentype/TranslateTypeDeclarations.ml | 61 +++++++++++++++---- tests/gentype_tests/genimport-single/Makefile | 40 ++++++++++++ .../genimport-single/package.json | 16 +++++ .../genimport-single/rescript.json | 19 ++++++ .../src/GenTypeImportExpectedErrors.gen.tsx | 44 +++++++++++++ .../src/GenTypeImportExpectedErrors.res | 39 ++++++++++++ .../src/GenTypeImportExpectedErrors.res.js | 36 +++++++++++ .../genimport-single/src/external-module.d.ts | 4 ++ .../genimport-single/ts-errors.txt | 5 ++ .../genimport-single/tsconfig.json | 16 +++++ tests/gentype_tests/stdlib-no-shims/Makefile | 3 +- .../typescript-react-example/Makefile | 2 + .../src/ImportJsValue.gen.tsx | 4 +- .../src/MyInput.gen.tsx | 6 +- .../src/TestFirstClassModules.gen.tsx | 4 +- .../src/TransitiveType1.gen.tsx | 4 +- .../src/TypeParams3.gen.tsx | 4 +- .../src/nested/Types.gen.tsx | 8 +-- .../src/react-event-focus-t.d.ts | 1 + .../src/shims/JsxEvent.shim.ts | 5 +- 24 files changed, 364 insertions(+), 29 deletions(-) create mode 100644 compiler/gentype/GentypeImportHelper.ml create mode 100644 compiler/gentype/GentypeTypeFold.ml create mode 100644 tests/gentype_tests/genimport-single/Makefile create mode 100644 tests/gentype_tests/genimport-single/package.json create mode 100644 tests/gentype_tests/genimport-single/rescript.json create mode 100644 tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx create mode 100644 tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res create mode 100644 tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res.js create mode 100644 tests/gentype_tests/genimport-single/src/external-module.d.ts create mode 100644 tests/gentype_tests/genimport-single/ts-errors.txt create mode 100644 tests/gentype_tests/genimport-single/tsconfig.json create mode 100644 tests/gentype_tests/typescript-react-example/src/react-event-focus-t.d.ts diff --git a/Makefile b/Makefile index 56b13f22c1..a9252c1b7a 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ test-syntax-roundtrip: test-gentype: make -C tests/gentype_tests/typescript-react-example clean test make -C tests/gentype_tests/stdlib-no-shims clean test + make -C tests/gentype_tests/genimport-single clean test test-rewatch: ./rewatch/tests/suite-ci.sh @@ -82,6 +83,7 @@ checkformat: clean-gentype: make -C tests/gentype_tests/typescript-react-example clean make -C tests/gentype_tests/stdlib-no-shims clean + make -C tests/gentype_tests/genimport-single clean clean-rewatch: cargo clean --manifest-path rewatch/Cargo.toml && rm -f rewatch/rewatch diff --git a/compiler/gentype/EmitJs.ml b/compiler/gentype/EmitJs.ml index 7a72efa2e1..13751ea93b 100644 --- a/compiler/gentype/EmitJs.ml +++ b/compiler/gentype/EmitJs.ml @@ -601,7 +601,7 @@ let propagate_annotation_to_sub_types ~code_items in (new_type_map, !annotated_set) -let emit_translation_as_string ~config ~file_name +let emit_translation_as_string ~(config : Config.t) ~file_name ~input_cmt_translate_type_declarations ~output_file_relative ~resolver (translation : Translation.t) = let initial_env = @@ -635,6 +635,17 @@ let emit_translation_as_string ~config ~file_name |> List.map (fun (type_declaration : CodeItem.type_declaration) -> type_declaration.export_from_type_declaration) in + (* Determine if we need to emit the helper alias for $GenTypeImport. *) + let needs_gentype_import_helper = + export_from_type_declarations + |> List.exists + (fun + ({CodeItem.export_type} : CodeItem.export_from_type_declaration) -> + match export_type.type_ with + | Ident {name; _} when String.equal name GentypeImportHelper.name -> + true + | _ -> false) + in let type_name_is_interface ~env = type_name_is_interface ~export_type_map ~export_type_map_from_other_files:env.export_type_map_from_other_files @@ -648,8 +659,33 @@ let emit_translation_as_string ~config ~file_name and env = initial_env in let env, emitters = (* imports from type declarations go first to build up type tables *) - import_types_from_type_declarations @ translation.import_types - |> List.sort_uniq Translation.import_type_compare + let all_import_types = + import_types_from_type_declarations @ translation.import_types + |> List.sort_uniq Translation.import_type_compare + in + (* Prefer direct imports of an alias name over aliased imports from other modules. + Use a single pass map: keep first direct (no alias) for a given name, + otherwise keep the first seen. *) + let chosen_by_name = + List.fold_left + (fun acc (it : CodeItem.import_type) -> + let key = + match it.as_type_name with + | Some alias -> alias + | None -> it.type_name + in + match StringMap.find key acc with + | (prev : CodeItem.import_type) -> ( + match (prev.as_type_name, it.as_type_name) with + | None, Some _ -> acc (* keep direct over aliased *) + | _ -> acc) + | exception Not_found -> StringMap.add key it acc) + StringMap.empty all_import_types + in + let filtered_import_types = + chosen_by_name |> StringMap.to_seq |> Seq.map snd |> List.of_seq + in + filtered_import_types |> emit_import_types ~config ~emitters ~env ~input_cmt_translate_type_declarations ~output_file_relative ~resolver ~type_name_is_interface @@ -702,6 +738,12 @@ let emit_translation_as_string ~config ~file_name module_items_emitter |> ExportModule.emit_all_module_items ~config ~emitters ~file_name in + (* If we used the $GenTypeImport wrapper, emit its helper alias early. *) + let emitters = + if needs_gentype_import_helper then + Emitters.export_early ~emitters GentypeImportHelper.alias + else emitters + in emitters |> emit_requires ~imported_value_or_component:false ~early:true ~config ~requires:final_env.requires_early diff --git a/compiler/gentype/GentypeImportHelper.ml b/compiler/gentype/GentypeImportHelper.ml new file mode 100644 index 0000000000..8e1850bcea --- /dev/null +++ b/compiler/gentype/GentypeImportHelper.ml @@ -0,0 +1,3 @@ +let name = "$GenTypeImport" + +let alias = "type $GenTypeImport = T;" diff --git a/compiler/gentype/GentypeTypeFold.ml b/compiler/gentype/GentypeTypeFold.ml new file mode 100644 index 0000000000..f4ce127c9f --- /dev/null +++ b/compiler/gentype/GentypeTypeFold.ml @@ -0,0 +1,19 @@ +open GenTypeCommon + +let rec fold f acc (t : type_) = + let acc = f acc t in + match t with + | Ident _ | TypeVar _ -> acc + | Array (t1, _) | Dict t1 | Option t1 | Null t1 | Nullable t1 | Promise t1 -> + fold f acc t1 + | Tuple ts -> List.fold_left (fold f) acc ts + | Object (_shape, fields) -> + List.fold_left (fun acc {type_} -> fold f acc type_) acc fields + | Function {arg_types; ret_type; _} -> + let acc = + List.fold_left (fun acc {a_type} -> fold f acc a_type) acc arg_types + in + fold f acc ret_type + | Variant {inherits; payloads; _} -> + let acc = List.fold_left (fold f) acc inherits in + List.fold_left (fun acc {t} -> fold f acc t) acc payloads diff --git a/compiler/gentype/TranslateTypeDeclarations.ml b/compiler/gentype/TranslateTypeDeclarations.ml index 2768bdf343..2020e38ed8 100644 --- a/compiler/gentype/TranslateTypeDeclarations.ml +++ b/compiler/gentype/TranslateTypeDeclarations.ml @@ -151,24 +151,61 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver | Some as_string -> (as_string, "$$" ^ name_with_module_path) | None -> (name_with_module_path, "$$" ^ name_with_module_path) in - let import_types = - [ - { - CodeItem.type_name; - as_type_name = Some as_type_name; - import_path = import_string |> ImportPath.from_string_unsafe; - }; - ] + let import_path = import_string |> ImportPath.from_string_unsafe in + let base_import = + {CodeItem.type_name; as_type_name = Some as_type_name; import_path} + in + (* If the declaration has a manifest type, capture its full translation + so we can both build the Expected type and import its dependencies. *) + let expected_translation_opt = + match declaration_kind with + | GeneralDeclaration (Some core_type) -> + Some + (core_type |> TranslateCoreType.translate_core_type ~config ~type_env) + | GeneralDeclarationFromTypes (Some type_expr) -> + Some + (type_expr + |> TranslateTypeExprFromTypes.translate_type_expr_from_types ~config + ~type_env) + | _ -> None + in + + (* Import any referenced non-builtin identifiers from the same module as + the base imported type. This ensures shims work (e.g. mapping ReactEvent + types to a local shim module), matching previous behavior. *) + let extra_type_imports = + match expected_translation_opt with + | Some tr -> + GentypeTypeFold.fold + (fun acc (t : GenTypeCommon.type_) -> + match t with + | Ident {builtin = false; name; _} -> name :: acc + | _ -> acc) + [] tr.type_ + |> List.sort_uniq String.compare + |> List.filter (fun n -> n <> type_name) + |> List.map (fun n -> + {CodeItem.type_name = n; as_type_name = None; import_path}) + | None -> [] in + let import_types = base_import :: extra_type_imports in let export_from_type_declaration = (* Make the imported type usable from other modules by exporting it too. *) + let imported_ident = + as_type_name + |> ident ~type_args:(type_vars |> List.map (fun s -> TypeVar s)) + in + let export_type_body = + match expected_translation_opt with + | Some tr -> + (* $GenTypeImport *) + ident GentypeImportHelper.name ~type_args:[tr.type_; imported_ident] + | None -> imported_ident + in typeName_ |> create_export_type_from_type_declaration ~doc_string ~annotation:GenType ~loc ~name_as:None ~opaque:(Some false) - ~type_: - (as_type_name - |> ident ~type_args:(type_vars |> List.map (fun s -> TypeVar s))) - ~type_env ~type_vars + ~type_:export_type_body ~type_env ~type_vars in [{CodeItem.import_types; export_from_type_declaration}] | (GeneralDeclarationFromTypes None | GeneralDeclaration None), None -> diff --git a/tests/gentype_tests/genimport-single/Makefile b/tests/gentype_tests/genimport-single/Makefile new file mode 100644 index 0000000000..52d6c034b8 --- /dev/null +++ b/tests/gentype_tests/genimport-single/Makefile @@ -0,0 +1,40 @@ +SHELL = /bin/bash + +test: + yarn workspaces focus @tests/gentype-genimport-single + yarn build + # Helper exists once in single generated file + grep -Fq 'type $$GenTypeImport = T;' src/GenTypeImportExpectedErrors.gen.tsx + # Wrapper lines for each case present + grep -Fq 'export type numberT = $$GenTypeImport,' src/GenTypeImportExpectedErrors.gen.tsx + # nested arrays may render as Array; accept either style + grep -Fq 'export type nestedArrayT = $$GenTypeImport' src/GenTypeImportExpectedErrors.gen.tsx + # Positive wrapper present too + grep -Fq 'export type stringT = $$GenTypeImport ts-errors.txt 2>&1 || true + # Expect exactly 5 TS2344 errors (the mismatches), and no others + test $$(grep -c 'error TS2344' ts-errors.txt) -eq 5 + grep -Fq "Type 'string' does not satisfy the constraint 'number'." ts-errors.txt + grep -Fq "Type 'string' does not satisfy the constraint '[number, string]'." ts-errors.txt + grep -Fq "Type 'string' does not satisfy the constraint 'number[]'." ts-errors.txt + grep -Fq "Type 'string' does not satisfy the constraint 'Promise'." ts-errors.txt + grep -Fq "Type 'string' does not satisfy the constraint 'number[][]'." ts-errors.txt + # Positive should not produce any error about constraint 'string' + if grep -Fq "constraint 'string'." ts-errors.txt; then \ + echo 'Unexpected error for positive string case' ; \ + exit 1 ; \ + else \ + echo 'All expected TS errors present; positive has no error' ; \ + fi + +clean: + yarn workspaces focus @tests/gentype-genimport-single + yarn clean + +.DEFAULT_GOAL := test + +.PHONY: clean test diff --git a/tests/gentype_tests/genimport-single/package.json b/tests/gentype_tests/genimport-single/package.json new file mode 100644 index 0000000000..0aa81605af --- /dev/null +++ b/tests/gentype_tests/genimport-single/package.json @@ -0,0 +1,16 @@ +{ + "name": "@tests/gentype-genimport-single", + "private": true, + "scripts": { + "build": "rescript legacy build", + "clean": "rescript clean", + "typecheck": "tsc" + }, + "dependencies": { + "rescript": "workspace:^" + }, + "devDependencies": { + "typescript": "5.8.2" + } +} + diff --git a/tests/gentype_tests/genimport-single/rescript.json b/tests/gentype_tests/genimport-single/rescript.json new file mode 100644 index 0000000000..b7a1dd1cbe --- /dev/null +++ b/tests/gentype_tests/genimport-single/rescript.json @@ -0,0 +1,19 @@ +{ + "gentypeconfig": { + "language": "typescript", + "module": "esmodule", + "importPath": "relative", + "debug": { "all": false }, + "exportInterfaces": false + }, + "name": "@tests/gentype-genimport-single", + "sources": [ + { "dir": "src", "subdirs": true } + ], + "package-specs": { + "module": "esmodule", + "in-source": true + }, + "suffix": ".res.js" +} + diff --git a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx new file mode 100644 index 0000000000..b2f0da94c7 --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx @@ -0,0 +1,44 @@ +/* TypeScript file generated from GenTypeImportExpectedErrors.res by genType. */ + +/* eslint-disable */ +/* tslint:disable */ + +type $GenTypeImport = T; + +import * as GenTypeImportExpectedErrorsJS from './GenTypeImportExpectedErrors.res.js'; + +import type {Type as $$arrayT} from 'external-module'; + +import type {Type as $$nestedArrayT} from 'external-module'; + +import type {Type as $$numberT} from 'external-module'; + +import type {Type as $$promiseT} from 'external-module'; + +import type {Type as $$stringT} from 'external-module'; + +import type {Type as $$tupleT} from 'external-module'; + +export type numberT = $GenTypeImport; + +export type tupleT = $GenTypeImport<[number, string],$$tupleT>; + +export type arrayT = $GenTypeImport; + +export type promiseT = $GenTypeImport,$$promiseT>; + +export type nestedArrayT = $GenTypeImport,$$nestedArrayT>; + +export type stringT = $GenTypeImport; + +export const useNumber: (x:numberT) => numberT = GenTypeImportExpectedErrorsJS.useNumber as any; + +export const useTuple: (x:tupleT) => tupleT = GenTypeImportExpectedErrorsJS.useTuple as any; + +export const useArray: (x:arrayT) => arrayT = GenTypeImportExpectedErrorsJS.useArray as any; + +export const usePromise: (x:promiseT) => promiseT = GenTypeImportExpectedErrorsJS.usePromise as any; + +export const useNestedArray: (x:nestedArrayT) => nestedArrayT = GenTypeImportExpectedErrorsJS.useNestedArray as any; + +export const useString: (x:stringT) => stringT = GenTypeImportExpectedErrorsJS.useString as any; diff --git a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res new file mode 100644 index 0000000000..6c44e0ab58 --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res @@ -0,0 +1,39 @@ +/* This module intentionally contains cases that should cause TypeScript errors + when the external imported Type mismatches the ReScript manifest type. */ + +@genType.import(("external-module", "Type")) +type numberT = int + +@genType +let useNumber = (x: numberT) => x + +@genType.import(("external-module", "Type")) +type tupleT = (int, string) + +@genType +let useTuple = (x: tupleT) => x + +@genType.import(("external-module", "Type")) +type arrayT = array + +@genType +let useArray = (x: arrayT) => x + +@genType.import(("external-module", "Type")) +type promiseT = Js.Promise.t + +@genType +let usePromise = (x: promiseT) => x + +@genType.import(("external-module", "Type")) +type nestedArrayT = array> + +@genType +let useNestedArray = (x: nestedArrayT) => x + +/* Positive case: string matches external Type=string */ +@genType.import(("external-module", "Type")) +type stringT = string + +@genType +let useString = (x: stringT) => x diff --git a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res.js b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res.js new file mode 100644 index 0000000000..c7070e2965 --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res.js @@ -0,0 +1,36 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function useNumber(x) { + return x; +} + +function useTuple(x) { + return x; +} + +function useArray(x) { + return x; +} + +function usePromise(x) { + return x; +} + +function useNestedArray(x) { + return x; +} + +function useString(x) { + return x; +} + +export { + useNumber, + useTuple, + useArray, + usePromise, + useNestedArray, + useString, +} +/* No side effect */ diff --git a/tests/gentype_tests/genimport-single/src/external-module.d.ts b/tests/gentype_tests/genimport-single/src/external-module.d.ts new file mode 100644 index 0000000000..9dfc7fb0e4 --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/external-module.d.ts @@ -0,0 +1,4 @@ +declare module "external-module" { + export type Type = string; +} + diff --git a/tests/gentype_tests/genimport-single/ts-errors.txt b/tests/gentype_tests/genimport-single/ts-errors.txt new file mode 100644 index 0000000000..2a1a8df6b4 --- /dev/null +++ b/tests/gentype_tests/genimport-single/ts-errors.txt @@ -0,0 +1,5 @@ +src/GenTypeImportExpectedErrors.gen.tsx(22,45): error TS2344: Type 'string' does not satisfy the constraint 'number'. +src/GenTypeImportExpectedErrors.gen.tsx(24,54): error TS2344: Type 'string' does not satisfy the constraint '[number, string]'. +src/GenTypeImportExpectedErrors.gen.tsx(26,46): error TS2344: Type 'string' does not satisfy the constraint 'number[]'. +src/GenTypeImportExpectedErrors.gen.tsx(28,55): error TS2344: Type 'string' does not satisfy the constraint 'Promise'. +src/GenTypeImportExpectedErrors.gen.tsx(30,59): error TS2344: Type 'string' does not satisfy the constraint 'number[][]'. diff --git a/tests/gentype_tests/genimport-single/tsconfig.json b/tests/gentype_tests/genimport-single/tsconfig.json new file mode 100644 index 0000000000..5f18b2ae39 --- /dev/null +++ b/tests/gentype_tests/genimport-single/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ES2017", + "module": "ESNext", + "strict": true, + "skipLibCheck": true, + "moduleResolution": "Node", + "allowJs": true, + "noEmit": true, + "jsx": "react-jsx", + "types": [] + }, + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"], + "exclude": ["node_modules"] +} + diff --git a/tests/gentype_tests/stdlib-no-shims/Makefile b/tests/gentype_tests/stdlib-no-shims/Makefile index b225f0ada3..1e55e7398e 100644 --- a/tests/gentype_tests/stdlib-no-shims/Makefile +++ b/tests/gentype_tests/stdlib-no-shims/Makefile @@ -1,13 +1,14 @@ SHELL = /bin/bash test: + yarn workspaces focus @tests/gentype-stdlib-no-shims yarn build yarn typecheck clean: + yarn workspaces focus @tests/gentype-stdlib-no-shims yarn clean .DEFAULT_GOAL := test .PHONY: clean test - diff --git a/tests/gentype_tests/typescript-react-example/Makefile b/tests/gentype_tests/typescript-react-example/Makefile index 46f6aae7a6..412f4131db 100644 --- a/tests/gentype_tests/typescript-react-example/Makefile +++ b/tests/gentype_tests/typescript-react-example/Makefile @@ -1,6 +1,7 @@ SHELL = /bin/bash test: + yarn workspaces focus @tests/gentype-react-example yarn build yarn check yarn typecheck @@ -9,6 +10,7 @@ test: || exit 1 clean: + yarn workspaces focus @tests/gentype-react-example yarn clean .DEFAULT_GOAL := test diff --git a/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx b/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx index 96acb5ab48..2ebb095fb2 100644 --- a/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx @@ -75,6 +75,8 @@ export const defaultTypeChecked: number = defaultNotChecked as any; // Export '$$default' early to allow circular import from the '.bs.js' file. export const $$default: unknown = defaultTypeChecked as number as any; +type $GenTypeImport = T; + const ImportJsValueJS = require('./ImportJsValue.res.js'); import type {AbsoluteValue as $$AbsoluteValue_t} from './MyMath'; @@ -93,7 +95,7 @@ export type point = { readonly x: number; readonly y: (undefined | number) }; export type numberOrString = $$numberOrString; -export type AbsoluteValue_t = $$AbsoluteValue_t; +export type AbsoluteValue_t = $GenTypeImport<{ readonly getAbs: () => number },$$AbsoluteValue_t>; export type stringFunction = $$stringFunction; diff --git a/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx b/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx index 9e9e897357..a551c35ec2 100644 --- a/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx @@ -11,9 +11,13 @@ export const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:in // Export '$$default' early to allow circular import from the '.bs.js' file. export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> as any; +type $GenTypeImport = T; + import type {inputFocusEvent as $$inputFocusEvent} from './shims/JsxEvent.shim'; -export type inputFocusEvent = $$inputFocusEvent; +import type {ReactEvent_Focus_t} from './shims/JsxEvent.shim'; + +export type inputFocusEvent = $GenTypeImport; export type props = { readonly onFocus?: onFocus }; diff --git a/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx index ee7c318a68..67e878c428 100644 --- a/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx @@ -7,10 +7,10 @@ import * as TestFirstClassModulesJS from './TestFirstClassModules.res.js'; import type {firstClassModule as FirstClassModulesInterface_firstClassModule} from './FirstClassModulesInterface.gen'; -import type {firstClassModule as FirstClassModules_firstClassModule} from './FirstClassModules.gen'; - import type {record as FirstClassModulesInterface_record} from './FirstClassModulesInterface.gen'; +import type {firstClassModule as FirstClassModules_firstClassModule} from './FirstClassModules.gen'; + export type firstClassModuleWithTypeEquations = { readonly out: (_1:o) => o; readonly Inner: { readonly inn: (_1:i) => i } }; export const convert: (x:FirstClassModules_firstClassModule) => FirstClassModules_firstClassModule = TestFirstClassModulesJS.convert as any; diff --git a/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx index 71698f9c87..55e2ae7733 100644 --- a/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx @@ -5,10 +5,10 @@ import * as TransitiveType1JS from './TransitiveType1.res.js'; -import type {t2Alias as TransitiveType2_t2Alias} from './TransitiveType2.gen'; - import type {t2 as TransitiveType2_t2} from './TransitiveType2.gen'; +import type {t2Alias as TransitiveType2_t2Alias} from './TransitiveType2.gen'; + export const convert: (x:TransitiveType2_t2) => TransitiveType2_t2 = TransitiveType1JS.convert as any; export const convertAlias: (x:TransitiveType2_t2Alias) => TransitiveType2_t2Alias = TransitiveType1JS.convertAlias as any; diff --git a/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx index 25d8ac0cb5..fe8050d86c 100644 --- a/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx @@ -5,10 +5,10 @@ import * as TypeParams3JS from './TypeParams3.res.js'; -import type {items2 as TypeParams2_items2} from './TypeParams2.gen'; - import type {items as TypeParams2_items} from './TypeParams2.gen'; +import type {items2 as TypeParams2_items2} from './TypeParams2.gen'; + export const test: (x:TypeParams2_items) => TypeParams2_items = TypeParams3JS.test as any; export const test2: (x:TypeParams2_items2) => TypeParams2_items2 = TypeParams3JS.test2 as any; diff --git a/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx b/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx index cda2b782d6..9217433483 100644 --- a/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx @@ -5,17 +5,17 @@ import * as TypesJS from './Types.res.js'; +import type {List_t as Belt_List_t} from '../../src/shims/Belt.shim'; + import type {Json_t as Js_Json_t} from '../../src/shims/Js.shim'; -import type {List_t as Belt_List_t} from '../../src/shims/Belt.shim'; +import type {t as Location_t} from '../../src/location/location.gen'; import type {M_t__ as TypeNameSanitize_M_t__} from '../../src/TypeNameSanitize.gen'; -import type {list} from '../../src/shims/RescriptPervasives.shim'; - import type {t_ as TypeNameSanitize_t_} from '../../src/TypeNameSanitize.gen'; -import type {t as Location_t} from '../../src/location/location.gen'; +import type {list} from '../../src/shims/RescriptPervasives.shim'; export type t = number; diff --git a/tests/gentype_tests/typescript-react-example/src/react-event-focus-t.d.ts b/tests/gentype_tests/typescript-react-example/src/react-event-focus-t.d.ts new file mode 100644 index 0000000000..12e901aa6f --- /dev/null +++ b/tests/gentype_tests/typescript-react-example/src/react-event-focus-t.d.ts @@ -0,0 +1 @@ +type ReactEvent_Focus_t = import("./shims/JsxEvent.shim").Focus_t; diff --git a/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.ts b/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.ts index c3b44ff021..e019aac8d5 100644 --- a/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.ts +++ b/tests/gentype_tests/typescript-react-example/src/shims/JsxEvent.shim.ts @@ -14,6 +14,9 @@ export abstract class Focus_t { protected opaque: unknown; } +// Alias used by genType wrapper when referring to ReactEvent.Focus.t as a TS symbol +export type ReactEvent_Focus_t = Focus_t; + export abstract class Form_t { protected opaque: unknown; } @@ -54,7 +57,7 @@ export abstract class Wheel_t { protected opaque: unknown; } -export type inputFocusEvent = React.FocusEvent; +export type inputFocusEvent = ReactEvent_Focus_t; export abstract class Mouse_t { protected opaque: unknown; From fd7153b45c7b153907e1b9c3cf02aa21dc5d0f4b Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Fri, 5 Sep 2025 21:48:36 +0200 Subject: [PATCH 02/10] fix --- tests/gentype_tests/genimport-single/package.json | 1 - yarn.lock | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/gentype_tests/genimport-single/package.json b/tests/gentype_tests/genimport-single/package.json index 0aa81605af..3c5e53d21e 100644 --- a/tests/gentype_tests/genimport-single/package.json +++ b/tests/gentype_tests/genimport-single/package.json @@ -13,4 +13,3 @@ "typescript": "5.8.2" } } - diff --git a/yarn.lock b/yarn.lock index 81e1630eae..cba41ebfa1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -660,6 +660,15 @@ __metadata: languageName: unknown linkType: soft +"@tests/gentype-genimport-single@workspace:tests/gentype_tests/genimport-single": + version: 0.0.0-use.local + resolution: "@tests/gentype-genimport-single@workspace:tests/gentype_tests/genimport-single" + dependencies: + rescript: "workspace:^" + typescript: "npm:5.8.2" + languageName: unknown + linkType: soft + "@tests/gentype-react-example@workspace:tests/gentype_tests/typescript-react-example": version: 0.0.0-use.local resolution: "@tests/gentype-react-example@workspace:tests/gentype_tests/typescript-react-example" From 59dbd4baebfb030ddf767d0a73c59583b17bda1e Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Sat, 6 Sep 2025 14:16:06 +0200 Subject: [PATCH 03/10] some tweaking of the structure, and explore an exact output mode --- compiler/gentype/Annotation.ml | 46 +- compiler/gentype/CodeItem.ml | 1 + compiler/gentype/EmitJs.ml | 67 +- compiler/gentype/GentypeImportHelper.ml | 18 + compiler/gentype/TranslateTypeDeclarations.ml | 102 +- compiler/gentype/Translation.ml | 6 +- lib/bs/build.ninja | 0 lib/rescript.lock | 1 + packages/playground/src/App.res.js | 2 + .../genimport-single/package.json | 1 + .../src/AriaComponents.gen.tsx | 18 + .../genimport-single/src/AriaComponents.res | 8 + .../src/AriaComponents.res.js | 2 + .../src/GenTypeImportExpectedErrors.gen.tsx | 24 +- .../genimport-single/ts-errors.txt | 10 +- .../src/ImportHookDefault.gen.tsx | 2 +- .../src/ImportJsValue.gen.tsx | 26 +- .../src/MyInput.gen.tsx | 8 +- yarn.lock | 2092 ++++++++++++++++- 19 files changed, 2301 insertions(+), 133 deletions(-) create mode 100644 lib/bs/build.ninja create mode 100644 lib/rescript.lock create mode 100644 packages/playground/src/App.res.js create mode 100644 tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx create mode 100644 tests/gentype_tests/genimport-single/src/AriaComponents.res create mode 100644 tests/gentype_tests/genimport-single/src/AriaComponents.res.js diff --git a/compiler/gentype/Annotation.ml b/compiler/gentype/Annotation.ml index 9c66678b38..9bafce6975 100644 --- a/compiler/gentype/Annotation.ml +++ b/compiler/gentype/Annotation.ml @@ -7,6 +7,7 @@ type attribute_payload = | IntPayload of string | StringPayload of string | TuplePayload of attribute_payload list + | RecordPayload of (string * attribute_payload) list | UnrecognizedPayload type t = GenType | GenTypeOpaque | NoGenType @@ -63,6 +64,26 @@ let rec get_attribute_payload check_text (attributes : Typedtree.attributes) = [] in Some (TuplePayload payloads) + | {pexp_desc = Pexp_record (fields, _)} -> + let items = + fields + |> List.fold_left + (fun acc + ({Parsetree.lid; x; _} : + Parsetree.expression Parsetree.record_element) -> + let key_opt = + match lid.Location.txt with + | Longident.Lident s -> Some s + | Longident.Ldot (_, s) -> Some s + | _ -> None + in + match (key_opt, from_expr x) with + | Some key, Some v -> (key, v) :: acc + | _ -> acc) + [] + |> List.rev + in + Some (RecordPayload items) | {pexp_desc = Pexp_ident {txt}} -> Some (IdentPayload txt) | _ -> None in @@ -138,14 +159,33 @@ let get_attribute_import_renaming attributes = let gentype_as_renaming = attributes |> get_gentype_as_renaming in match (attribute_import, gentype_as_renaming) with | Some (_, StringPayload import_string), _ -> - (Some import_string, gentype_as_renaming) + (Some import_string, gentype_as_renaming, None, None) | ( Some ( _, TuplePayload [StringPayload import_string; StringPayload rename_string] ), _ ) -> - (Some import_string, Some rename_string) - | _ -> (None, gentype_as_renaming) + (* Tuple form encodes (importPath, remoteExportName). Keep remote name separate. *) + (Some import_string, gentype_as_renaming, None, Some rename_string) + | Some (_, RecordPayload opts), _ -> + let import_tuple_opt = List.assoc_opt "importPath" opts in + let import_string_opt, rename_string_opt = + match import_tuple_opt with + | Some (TuplePayload [StringPayload import_string; StringPayload rename]) + -> + (Some import_string, Some rename) + | Some (TuplePayload [StringPayload import_string]) -> + (Some import_string, None) + | _ -> (None, None) + in + let exact_opt = + match List.assoc_opt "exact" opts with + | Some (BoolPayload b) -> Some b + | _ -> None + in + (* Keep remote export name separate from local alias (@genType.as) *) + (import_string_opt, gentype_as_renaming, exact_opt, rename_string_opt) + | _ -> (None, gentype_as_renaming, None, None) let get_tag attributes = match attributes |> get_attribute_payload tag_is_tag with diff --git a/compiler/gentype/CodeItem.ml b/compiler/gentype/CodeItem.ml index 7913263c67..046db706cb 100644 --- a/compiler/gentype/CodeItem.ml +++ b/compiler/gentype/CodeItem.ml @@ -47,6 +47,7 @@ type export_type_map = export_type_item StringMap.t type type_declaration = { export_from_type_declaration: export_from_type_declaration; import_types: import_type list; + expected_type: type_ option; } type t = ExportValue of export_value | ImportValue of import_value diff --git a/compiler/gentype/EmitJs.ml b/compiler/gentype/EmitJs.ml index 13751ea93b..77de84668e 100644 --- a/compiler/gentype/EmitJs.ml +++ b/compiler/gentype/EmitJs.ml @@ -635,16 +635,56 @@ let emit_translation_as_string ~(config : Config.t) ~file_name |> List.map (fun (type_declaration : CodeItem.type_declaration) -> type_declaration.export_from_type_declaration) in - (* Determine if we need to emit the helper alias for $GenTypeImport. *) - let needs_gentype_import_helper = + (* Emit a named alias for the ReScript-side expected shape to improve TS errors. *) + let emitters = + let type_name_is_interface = + type_name_is_interface ~export_type_map + ~export_type_map_from_other_files: + initial_env.export_type_map_from_other_files + in + annotated_type_declarations + |> List.fold_left + (fun emitters (td : CodeItem.type_declaration) -> + match td.expected_type with + | None -> emitters + | Some expected + when GentypeImportHelper.should_inline_expected expected -> + emitters + | Some expected -> + let ({CodeItem.export_type} + : CodeItem.export_from_type_declaration) = + td.export_from_type_declaration + in + let alias_name = + (export_type.resolved_type_name |> ResolvedName.to_string) + ^ "$ReScript" + in + let type_params_string = + EmitText.generics_string ~type_vars:export_type.type_vars + in + let expected_string = + EmitType.type_to_string ~config ~type_name_is_interface expected + in + Emitters.export_early ~emitters + ("type " ^ alias_name ^ type_params_string ^ " = " + ^ expected_string ^ ";")) + Emitters.initial + in + (* Determine if we need to emit the helper alias(es) for $GenTypeImport. *) + let needs_gentype_import_helper, needs_gentype_import_strict_helper = export_from_type_declarations - |> List.exists - (fun - ({CodeItem.export_type} : CodeItem.export_from_type_declaration) -> + |> List.fold_left + (fun (need_std, need_strict) + ({CodeItem.export_type} : CodeItem.export_from_type_declaration) + -> match export_type.type_ with | Ident {name; _} when String.equal name GentypeImportHelper.name -> - true - | _ -> false) + (true, need_strict) + | Ident {name; _} + when String.equal name GentypeImportHelper.strict_name -> + (need_std, true) + | _ -> (need_std, need_strict)) + (false, false) in let type_name_is_interface ~env = type_name_is_interface ~export_type_map @@ -654,7 +694,7 @@ let emit_translation_as_string ~(config : Config.t) ~file_name try export_type_map |> StringMap.find s with Not_found -> env.export_type_map_from_other_files |> StringMap.find s in - let emitters = Emitters.initial + let emitters = emitters and module_items_emitter = ExportModule.create_module_items_emitter () and env = initial_env in let env, emitters = @@ -738,10 +778,15 @@ let emit_translation_as_string ~(config : Config.t) ~file_name module_items_emitter |> ExportModule.emit_all_module_items ~config ~emitters ~file_name in - (* If we used the $GenTypeImport wrapper, emit its helper alias early. *) + (* If we used the $GenTypeImport wrapper(s), emit helper alias(es) early. *) let emitters = - if needs_gentype_import_helper then - Emitters.export_early ~emitters GentypeImportHelper.alias + let emitters = + if needs_gentype_import_helper then + Emitters.export_early ~emitters GentypeImportHelper.alias + else emitters + in + if needs_gentype_import_strict_helper then + Emitters.export_early ~emitters GentypeImportHelper.strict_alias else emitters in emitters diff --git a/compiler/gentype/GentypeImportHelper.ml b/compiler/gentype/GentypeImportHelper.ml index 8e1850bcea..951740b55d 100644 --- a/compiler/gentype/GentypeImportHelper.ml +++ b/compiler/gentype/GentypeImportHelper.ml @@ -1,3 +1,21 @@ +open GenTypeCommon + let name = "$GenTypeImport" let alias = "type $GenTypeImport = T;" + +let strict_name = "$GenTypeImportStrict" + +let strict_alias = + "type $GenTypeImportStrict = Expected;" + +let rec should_inline_expected (t : type_) : bool = + match t with + | Ident {builtin = true; name; _} -> ( + match name with + | "number" | "string" | "boolean" -> true + | _ -> false) + | Tuple inner -> inner |> List.for_all should_inline_expected + | Array (t, _) -> should_inline_expected t + | Promise t -> should_inline_expected t + | _ -> false diff --git a/compiler/gentype/TranslateTypeDeclarations.ml b/compiler/gentype/TranslateTypeDeclarations.ml index 2020e38ed8..9d314aa233 100644 --- a/compiler/gentype/TranslateTypeDeclarations.ml +++ b/compiler/gentype/TranslateTypeDeclarations.ml @@ -59,7 +59,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver | false -> None (* one means don't know *) in - let import_string_opt, name_as = + let import_string_opt, name_as, import_exact_opt, remote_export_name_opt = type_attributes |> Annotation.get_attribute_import_renaming in let unboxed_annotation = @@ -83,7 +83,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver |> Translation.translate_dependencies ~config ~output_file_relative ~resolver in - {CodeItem.import_types; export_from_type_declaration} + {CodeItem.import_types; export_from_type_declaration; expected_type = None} in let translate_label_declarations ?(inline = false) label_declarations = let field_translations = @@ -146,11 +146,15 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver let name_with_module_path = typeName_ |> TypeEnv.add_module_path ~type_env |> ResolvedName.to_string in - let type_name, as_type_name = - match name_as with - | Some as_string -> (as_string, "$$" ^ name_with_module_path) - | None -> (name_with_module_path, "$$" ^ name_with_module_path) + (* Use the remote export name (if provided) to build the import and alias. + Preserve casing from the TS source exactly. *) + let remote_type_name = + match remote_export_name_opt with + | Some s -> s + | None -> name_with_module_path in + let type_name = remote_type_name in + let as_type_name = remote_type_name ^ "$TypeScript" in let import_path = import_string |> ImportPath.from_string_unsafe in let base_import = {CodeItem.type_name; as_type_name = Some as_type_name; import_path} @@ -167,6 +171,59 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver (type_expr |> TranslateTypeExprFromTypes.translate_type_expr_from_types ~config ~type_env) + | RecordDeclarationFromTypes label_declarations -> + Some (label_declarations |> translate_label_declarations) + | VariantDeclarationFromTypes constructor_declarations -> + let variants = + constructor_declarations + |> List.map (fun constructor_declaration -> + let constructor_args = constructor_declaration.Types.cd_args in + let attributes = constructor_declaration.cd_attributes in + let name = constructor_declaration.cd_id |> Ident.name in + let args_translation = + match constructor_args with + | Cstr_tuple type_exprs -> + type_exprs + |> TranslateTypeExprFromTypes + .translate_type_exprs_from_types ~config ~type_env + | Cstr_record label_declarations -> + [ + label_declarations + |> translate_label_declarations ~inline:true; + ] + in + let arg_types = + args_translation + |> List.map (fun {TranslateTypeExprFromTypes.type_} -> type_) + in + (name, attributes, arg_types)) + in + let variants_no_payload, variants_with_payload = + variants |> List.partition (fun (_, _, arg_types) -> arg_types = []) + in + let no_payloads = + variants_no_payload + |> List.map (fun (name, attributes, _argTypes) -> + (name, attributes) |> create_case ~poly:false) + in + let payloads = + variants_with_payload + |> List.map (fun (name, attributes, arg_types) -> + let type_ = + match arg_types with + | [type_] -> type_ + | _ -> Tuple arg_types + in + { + case = (name, attributes) |> create_case ~poly:false; + t = type_; + }) + in + let variant_typ = + create_variant ~inherits:[] ~no_payloads ~payloads ~polymorphic:false + ~tag:tag_annotation ~unboxed:unboxed_annotation + in + Some {TranslateTypeExprFromTypes.dependencies = []; type_ = variant_typ} | _ -> None in @@ -197,9 +254,21 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver in let export_type_body = match expected_translation_opt with - | Some tr -> - (* $GenTypeImport *) - ident GentypeImportHelper.name ~type_args:[tr.type_; imported_ident] + | Some tr -> ( + let expected_for_wrapper = + if GentypeImportHelper.should_inline_expected tr.type_ then tr.type_ + else + name_with_module_path ^ "$ReScript" + |> ident ~builtin:false + ~type_args:(type_vars |> List.map (fun s -> TypeVar s)) + in + match import_exact_opt with + | Some true -> + ident GentypeImportHelper.strict_name + ~type_args:[imported_ident; expected_for_wrapper] + | _ -> + ident GentypeImportHelper.name + ~type_args:[expected_for_wrapper; imported_ident]) | None -> imported_ident in typeName_ @@ -207,7 +276,16 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver ~annotation:GenType ~loc ~name_as:None ~opaque:(Some false) ~type_:export_type_body ~type_env ~type_vars in - [{CodeItem.import_types; export_from_type_declaration}] + [ + { + CodeItem.import_types; + export_from_type_declaration; + expected_type = + (match expected_translation_opt with + | Some tr -> Some tr.type_ + | None -> None); + }; + ] | (GeneralDeclarationFromTypes None | GeneralDeclaration None), None -> { CodeItem.import_types = []; @@ -215,6 +293,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver type_name |> create_export_type_from_type_declaration ~doc_string ~annotation ~loc ~name_as ~opaque:(Some true) ~type_:unknown ~type_env ~type_vars; + expected_type = None; } |> return_type_declaration | GeneralDeclarationFromTypes (Some type_expr), None -> @@ -270,6 +349,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver type_name |> create_export_type_from_type_declaration ~doc_string ~annotation ~loc ~name_as ~opaque ~type_ ~type_env ~type_vars; + expected_type = None; } |> return_type_declaration | VariantDeclarationFromTypes constructor_declarations, None -> @@ -348,7 +428,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver |> List.map (fun (_, _, _, import_types) -> import_types) |> List.concat in - {CodeItem.export_from_type_declaration; import_types} + {CodeItem.export_from_type_declaration; import_types; expected_type = None} |> return_type_declaration | NoDeclaration, None -> [] diff --git a/compiler/gentype/Translation.ml b/compiler/gentype/Translation.ml index c80b413350..1db30006cc 100644 --- a/compiler/gentype/Translation.ml +++ b/compiler/gentype/Translation.ml @@ -138,7 +138,10 @@ let translate_primitive ~config ~output_file_relative ~resolver ~type_env value_description.val_desc |> TranslateCoreType.translate_core_type ~config ~type_env in - let attribute_import, attribute_renaming = + let ( attribute_import, + attribute_renaming, + _import_exact_opt, + _remote_export_name_opt ) = value_description.val_attributes |> Annotation.get_attribute_import_renaming in match (type_expr_translation.type_, attribute_import) with @@ -205,6 +208,7 @@ let add_type_declarations_from_module_equations ~type_env (translation : t) = .annotation; }; import_types = []; + expected_type = None; })) |> List.concat in diff --git a/lib/bs/build.ninja b/lib/bs/build.ninja new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/rescript.lock b/lib/rescript.lock new file mode 100644 index 0000000000..2c9e597f0a --- /dev/null +++ b/lib/rescript.lock @@ -0,0 +1 @@ +69167 \ No newline at end of file diff --git a/packages/playground/src/App.res.js b/packages/playground/src/App.res.js new file mode 100644 index 0000000000..d856702bfe --- /dev/null +++ b/packages/playground/src/App.res.js @@ -0,0 +1,2 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE +/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/tests/gentype_tests/genimport-single/package.json b/tests/gentype_tests/genimport-single/package.json index 3c5e53d21e..a43b7fac22 100644 --- a/tests/gentype_tests/genimport-single/package.json +++ b/tests/gentype_tests/genimport-single/package.json @@ -7,6 +7,7 @@ "typecheck": "tsc" }, "dependencies": { + "react-aria-components": "1.12.1", "rescript": "workspace:^" }, "devDependencies": { diff --git a/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx b/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx new file mode 100644 index 0000000000..ddd806fe2a --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx @@ -0,0 +1,18 @@ +/* TypeScript file generated from AriaComponents.res by genType. */ + +/* eslint-disable */ +/* tslint:disable */ + +type groupRenderProps$ReScript = { + readonly isHovered: boolean; + readonly isFocusWithin: boolean; + readonly isFocusVisible: boolean; + readonly isDisabled: boolean; + readonly isInvalid: boolean +}; + +type $GenTypeImportStrict = Expected; + +import type {GroupRenderProps as GroupRenderProps$TypeScript} from 'react-aria-components'; + +export type groupRenderProps = $GenTypeImportStrict; diff --git a/tests/gentype_tests/genimport-single/src/AriaComponents.res b/tests/gentype_tests/genimport-single/src/AriaComponents.res new file mode 100644 index 0000000000..308c0cf0c1 --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/AriaComponents.res @@ -0,0 +1,8 @@ +@genType.import({importPath: ("react-aria-components", "GroupRenderProps"), exact: true}) +type groupRenderProps = { + isHovered: bool, + isFocusWithin: bool, + isFocusVisible: bool, + isDisabled: bool, + isInvalid: bool, +} diff --git a/tests/gentype_tests/genimport-single/src/AriaComponents.res.js b/tests/gentype_tests/genimport-single/src/AriaComponents.res.js new file mode 100644 index 0000000000..d856702bfe --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/AriaComponents.res.js @@ -0,0 +1,2 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE +/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx index b2f0da94c7..1d30781eaa 100644 --- a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx +++ b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx @@ -7,29 +7,19 @@ type $GenTypeImport = T; import * as GenTypeImportExpectedErrorsJS from './GenTypeImportExpectedErrors.res.js'; -import type {Type as $$arrayT} from 'external-module'; +import type {Type as Type$TypeScript} from 'external-module'; -import type {Type as $$nestedArrayT} from 'external-module'; +export type numberT = $GenTypeImport; -import type {Type as $$numberT} from 'external-module'; +export type tupleT = $GenTypeImport<[number, string],Type$TypeScript>; -import type {Type as $$promiseT} from 'external-module'; +export type arrayT = $GenTypeImport; -import type {Type as $$stringT} from 'external-module'; +export type promiseT = $GenTypeImport,Type$TypeScript>; -import type {Type as $$tupleT} from 'external-module'; +export type nestedArrayT = $GenTypeImport,Type$TypeScript>; -export type numberT = $GenTypeImport; - -export type tupleT = $GenTypeImport<[number, string],$$tupleT>; - -export type arrayT = $GenTypeImport; - -export type promiseT = $GenTypeImport,$$promiseT>; - -export type nestedArrayT = $GenTypeImport,$$nestedArrayT>; - -export type stringT = $GenTypeImport; +export type stringT = $GenTypeImport; export const useNumber: (x:numberT) => numberT = GenTypeImportExpectedErrorsJS.useNumber as any; diff --git a/tests/gentype_tests/genimport-single/ts-errors.txt b/tests/gentype_tests/genimport-single/ts-errors.txt index 2a1a8df6b4..23eaf510c2 100644 --- a/tests/gentype_tests/genimport-single/ts-errors.txt +++ b/tests/gentype_tests/genimport-single/ts-errors.txt @@ -1,5 +1,5 @@ -src/GenTypeImportExpectedErrors.gen.tsx(22,45): error TS2344: Type 'string' does not satisfy the constraint 'number'. -src/GenTypeImportExpectedErrors.gen.tsx(24,54): error TS2344: Type 'string' does not satisfy the constraint '[number, string]'. -src/GenTypeImportExpectedErrors.gen.tsx(26,46): error TS2344: Type 'string' does not satisfy the constraint 'number[]'. -src/GenTypeImportExpectedErrors.gen.tsx(28,55): error TS2344: Type 'string' does not satisfy the constraint 'Promise'. -src/GenTypeImportExpectedErrors.gen.tsx(30,59): error TS2344: Type 'string' does not satisfy the constraint 'number[][]'. +src/GenTypeImportExpectedErrors.gen.tsx(12,45): error TS2344: Type 'string' does not satisfy the constraint 'number'. +src/GenTypeImportExpectedErrors.gen.tsx(14,54): error TS2344: Type 'string' does not satisfy the constraint '[number, string]'. +src/GenTypeImportExpectedErrors.gen.tsx(16,46): error TS2344: Type 'string' does not satisfy the constraint 'number[]'. +src/GenTypeImportExpectedErrors.gen.tsx(18,55): error TS2344: Type 'string' does not satisfy the constraint 'Promise'. +src/GenTypeImportExpectedErrors.gen.tsx(20,59): error TS2344: Type 'string' does not satisfy the constraint 'number[][]'. diff --git a/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx b/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx index 8552188b0e..f7ddd32bc9 100644 --- a/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx @@ -3,7 +3,7 @@ /* eslint-disable */ /* tslint:disable */ -import {default as makeNotChecked} from './hookExample'; +import {make as makeNotChecked} from './hookExample'; import {default as defaultNotChecked} from './hookExample'; diff --git a/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx b/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx index 2ebb095fb2..a34ffb0277 100644 --- a/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx @@ -21,6 +21,8 @@ import {polymorphic as polymorphicNotChecked} from './MyMath'; import {default as defaultNotChecked} from './MyMath'; +type AbsoluteValue_t$ReScript = { readonly getAbs: () => number }; + // In case of type error, check the type of 'round' in 'ImportJsValue.res' and './MyMath'. export const roundTypeChecked: (_1:number) => number = roundNotChecked as any; @@ -79,25 +81,23 @@ type $GenTypeImport = T; const ImportJsValueJS = require('./ImportJsValue.res.js'); -import type {AbsoluteValue as $$AbsoluteValue_t} from './MyMath'; - -import type {num as $$myNum} from './MyMath'; +import type {AbsoluteValue as AbsoluteValue$TypeScript} from './MyMath'; -import type {num as $$num} from './MyMath'; +import type {num as num$TypeScript} from './MyMath'; -import type {numberOrString as $$numberOrString} from './MyMath'; +import type {numberOrString as numberOrString$TypeScript} from './MyMath'; -import type {polyType as $$polyType} from './MyMath'; +import type {polyType as polyType$TypeScript} from './MyMath'; -import type {stringFunction as $$stringFunction} from './MyMath'; +import type {stringFunction as stringFunction$TypeScript} from './MyMath'; export type point = { readonly x: number; readonly y: (undefined | number) }; -export type numberOrString = $$numberOrString; +export type numberOrString = numberOrString$TypeScript; -export type AbsoluteValue_t = $GenTypeImport<{ readonly getAbs: () => number },$$AbsoluteValue_t>; +export type AbsoluteValue_t = $GenTypeImport; -export type stringFunction = $$stringFunction; +export type stringFunction = stringFunction$TypeScript; export type color = "tomato" | "gray"; @@ -105,11 +105,11 @@ export type variant = { TAG: "I"; _0: number } | { TAG: "S"; _0: string }; -export type num = $$num; +export type num = num$TypeScript; -export type myNum = $$myNum; +export type myNum = num$TypeScript; -export type polyType = $$polyType; +export type polyType = polyType$TypeScript; export const roundedNumber: number = ImportJsValueJS.roundedNumber as any; diff --git a/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx b/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx index a551c35ec2..074dacfc90 100644 --- a/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx @@ -5,6 +5,8 @@ import {default as defaultNotChecked} from './MyInput'; +type inputFocusEvent$ReScript = ReactEvent_Focus_t; + // In case of type error, check the type of 'default' in 'MyInput.res' and './MyInput'. export const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> = defaultNotChecked as any; @@ -13,11 +15,11 @@ export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ re type $GenTypeImport = T; -import type {inputFocusEvent as $$inputFocusEvent} from './shims/JsxEvent.shim'; - import type {ReactEvent_Focus_t} from './shims/JsxEvent.shim'; -export type inputFocusEvent = $GenTypeImport; +import type {inputFocusEvent as inputFocusEvent$TypeScript} from './shims/JsxEvent.shim'; + +export type inputFocusEvent = $GenTypeImport; export type props = { readonly onFocus?: onFocus }; diff --git a/yarn.lock b/yarn.lock index cba41ebfa1..5b16677dc4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -274,117 +274,1892 @@ __metadata: languageName: node linkType: hard +"@formatjs/ecma402-abstract@npm:2.3.4": + version: 2.3.4 + resolution: "@formatjs/ecma402-abstract@npm:2.3.4" + dependencies: + "@formatjs/fast-memoize": "npm:2.2.7" + "@formatjs/intl-localematcher": "npm:0.6.1" + decimal.js: "npm:^10.4.3" + tslib: "npm:^2.8.0" + checksum: 10c0/2644bc618a34dc610ef9691281eeb45ae6175e6982cf19f1bd140672fc95c748747ce3c85b934649ea7e4a304f7ae0060625fd53d5df76f92ca3acf743e1eb0a + languageName: node + linkType: hard + +"@formatjs/fast-memoize@npm:2.2.7": + version: 2.2.7 + resolution: "@formatjs/fast-memoize@npm:2.2.7" + dependencies: + tslib: "npm:^2.8.0" + checksum: 10c0/f5eabb0e4ab7162297df8252b4cfde194b23248120d9df267592eae2be2d2f7c4f670b5a70523d91b4ecdc35d40e65823bb8eeba8dd79fbf8601a972bf3b8866 + languageName: node + linkType: hard + +"@formatjs/icu-messageformat-parser@npm:2.11.2": + version: 2.11.2 + resolution: "@formatjs/icu-messageformat-parser@npm:2.11.2" + dependencies: + "@formatjs/ecma402-abstract": "npm:2.3.4" + "@formatjs/icu-skeleton-parser": "npm:1.8.14" + tslib: "npm:^2.8.0" + checksum: 10c0/a121f2d2c6b36a1632ffd64c3545e2500c8ee0f7fee5db090318c035d635c430ab123faedb5d000f18d9423a7b55fbf670b84e2e2dd72cc307a38aed61d3b2e0 + languageName: node + linkType: hard + +"@formatjs/icu-skeleton-parser@npm:1.8.14": + version: 1.8.14 + resolution: "@formatjs/icu-skeleton-parser@npm:1.8.14" + dependencies: + "@formatjs/ecma402-abstract": "npm:2.3.4" + tslib: "npm:^2.8.0" + checksum: 10c0/a1807ed6e90b8a2e8d0e5b5125e6f9a2c057d3cff377fb031d2333af7cfaa6de4ed3a15c23da7294d4c3557f8b28b2163246434a19720f26b5db0497d97e9b58 + languageName: node + linkType: hard + +"@formatjs/intl-localematcher@npm:0.6.1": + version: 0.6.1 + resolution: "@formatjs/intl-localematcher@npm:0.6.1" + dependencies: + tslib: "npm:^2.8.0" + checksum: 10c0/bacbedd508519c1bb5ca2620e89dc38f12101be59439aa14aa472b222915b462cb7d679726640f6dcf52a05dd218b5aa27ccd60f2e5010bb96f1d4929848cde0 + languageName: node + linkType: hard + +"@internationalized/date@npm:^3.9.0": + version: 3.9.0 + resolution: "@internationalized/date@npm:3.9.0" + dependencies: + "@swc/helpers": "npm:^0.5.0" + checksum: 10c0/8f2bf54c407aa95ab9922759c27f19bd9185bc6c4bde936fb5cc7a99bf764de8483102a61d53afa0598eefa11711617d3c05a65e8a5cb8bfac10c2c0800e488a + languageName: node + linkType: hard + +"@internationalized/message@npm:^3.1.8": + version: 3.1.8 + resolution: "@internationalized/message@npm:3.1.8" + dependencies: + "@swc/helpers": "npm:^0.5.0" + intl-messageformat: "npm:^10.1.0" + checksum: 10c0/91019d66d62ab6733fa46ed495fac6878bcc98f082e51be9fd0e4b5836a4df0f488c8dcd218f2e566c713e59cc68ef3aa5fc45e5b9bca8cca458d0990765b77a + languageName: node + linkType: hard + +"@internationalized/number@npm:^3.6.5": + version: 3.6.5 + resolution: "@internationalized/number@npm:3.6.5" + dependencies: + "@swc/helpers": "npm:^0.5.0" + checksum: 10c0/f87d710863a8dbf057aac311193c82f3c42e862abdd99e5b71034f1022926036552620eab5dd00c23e975f28b9e41e830cb342ba0264436749d9cdc5ae031d44 + languageName: node + linkType: hard + +"@internationalized/string@npm:^3.2.7": + version: 3.2.7 + resolution: "@internationalized/string@npm:3.2.7" + dependencies: + "@swc/helpers": "npm:^0.5.0" + checksum: 10c0/8f7bea379ce047026ef20d535aa1bd7612a5e5a5108d1e514965696a46bce34e38111411943b688d00dae2c81eae7779ae18343961310696d32ebb463a19b94a + languageName: node + linkType: hard + "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" dependencies: - string-width: "npm:^5.1.2" - string-width-cjs: "npm:string-width@^4.2.0" - strip-ansi: "npm:^7.0.1" - strip-ansi-cjs: "npm:strip-ansi@^6.0.1" - wrap-ansi: "npm:^8.1.0" - wrap-ansi-cjs: "npm:wrap-ansi@^7.0.0" - checksum: 10c0/b1bf42535d49f11dc137f18d5e4e63a28c5569de438a221c369483731e9dac9fb797af554e8bf02b6192d1e5eba6e6402cf93900c3d0ac86391d00d04876789e + string-width: "npm:^5.1.2" + string-width-cjs: "npm:string-width@^4.2.0" + strip-ansi: "npm:^7.0.1" + strip-ansi-cjs: "npm:strip-ansi@^6.0.1" + wrap-ansi: "npm:^8.1.0" + wrap-ansi-cjs: "npm:wrap-ansi@^7.0.0" + checksum: 10c0/b1bf42535d49f11dc137f18d5e4e63a28c5569de438a221c369483731e9dac9fb797af554e8bf02b6192d1e5eba6e6402cf93900c3d0ac86391d00d04876789e + languageName: node + linkType: hard + +"@isaacs/fs-minipass@npm:^4.0.0": + version: 4.0.1 + resolution: "@isaacs/fs-minipass@npm:4.0.1" + dependencies: + minipass: "npm:^7.0.4" + checksum: 10c0/c25b6dc1598790d5b55c0947a9b7d111cfa92594db5296c3b907e2f533c033666f692a3939eadac17b1c7c40d362d0b0635dc874cbfe3e70db7c2b07cc97a5d2 + languageName: node + linkType: hard + +"@istanbuljs/load-nyc-config@npm:^1.0.0": + version: 1.1.0 + resolution: "@istanbuljs/load-nyc-config@npm:1.1.0" + dependencies: + camelcase: "npm:^5.3.1" + find-up: "npm:^4.1.0" + get-package-type: "npm:^0.1.0" + js-yaml: "npm:^3.13.1" + resolve-from: "npm:^5.0.0" + checksum: 10c0/dd2a8b094887da5a1a2339543a4933d06db2e63cbbc2e288eb6431bd832065df0c099d091b6a67436e71b7d6bf85f01ce7c15f9253b4cbebcc3b9a496165ba42 + languageName: node + linkType: hard + +"@istanbuljs/schema@npm:^0.1.2": + version: 0.1.3 + resolution: "@istanbuljs/schema@npm:0.1.3" + checksum: 10c0/61c5286771676c9ca3eb2bd8a7310a9c063fb6e0e9712225c8471c582d157392c88f5353581c8c9adbe0dff98892317d2fdfc56c3499aa42e0194405206a963a + languageName: node + linkType: hard + +"@jridgewell/gen-mapping@npm:^0.3.5": + version: 0.3.8 + resolution: "@jridgewell/gen-mapping@npm:0.3.8" + dependencies: + "@jridgewell/set-array": "npm:^1.2.1" + "@jridgewell/sourcemap-codec": "npm:^1.4.10" + "@jridgewell/trace-mapping": "npm:^0.3.24" + checksum: 10c0/c668feaf86c501d7c804904a61c23c67447b2137b813b9ce03eca82cb9d65ac7006d766c218685d76e3d72828279b6ee26c347aa1119dab23fbaf36aed51585a + languageName: node + linkType: hard + +"@jridgewell/resolve-uri@npm:^3.1.0": + version: 3.1.2 + resolution: "@jridgewell/resolve-uri@npm:3.1.2" + checksum: 10c0/d502e6fb516b35032331406d4e962c21fe77cdf1cbdb49c6142bcbd9e30507094b18972778a6e27cbad756209cfe34b1a27729e6fa08a2eb92b33943f680cf1e + languageName: node + linkType: hard + +"@jridgewell/set-array@npm:^1.2.1": + version: 1.2.1 + resolution: "@jridgewell/set-array@npm:1.2.1" + checksum: 10c0/2a5aa7b4b5c3464c895c802d8ae3f3d2b92fcbe84ad12f8d0bfbb1f5ad006717e7577ee1fd2eac00c088abe486c7adb27976f45d2941ff6b0b92b2c3302c60f4 + languageName: node + linkType: hard + +"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14": + version: 1.5.0 + resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" + checksum: 10c0/2eb864f276eb1096c3c11da3e9bb518f6d9fc0023c78344cdc037abadc725172c70314bdb360f2d4b7bffec7f5d657ce006816bc5d4ecb35e61b66132db00c18 + languageName: node + linkType: hard + +"@jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25": + version: 0.3.25 + resolution: "@jridgewell/trace-mapping@npm:0.3.25" + dependencies: + "@jridgewell/resolve-uri": "npm:^3.1.0" + "@jridgewell/sourcemap-codec": "npm:^1.4.14" + checksum: 10c0/3d1ce6ebc69df9682a5a8896b414c6537e428a1d68b02fcc8363b04284a8ca0df04d0ee3013132252ab14f2527bc13bea6526a912ecb5658f0e39fd2860b4df4 + languageName: node + linkType: hard + +"@npmcli/agent@npm:^3.0.0": + version: 3.0.0 + resolution: "@npmcli/agent@npm:3.0.0" + dependencies: + agent-base: "npm:^7.1.0" + http-proxy-agent: "npm:^7.0.0" + https-proxy-agent: "npm:^7.0.1" + lru-cache: "npm:^10.0.1" + socks-proxy-agent: "npm:^8.0.3" + checksum: 10c0/efe37b982f30740ee77696a80c196912c274ecd2cb243bc6ae7053a50c733ce0f6c09fda085145f33ecf453be19654acca74b69e81eaad4c90f00ccffe2f9271 + languageName: node + linkType: hard + +"@npmcli/fs@npm:^4.0.0": + version: 4.0.0 + resolution: "@npmcli/fs@npm:4.0.0" + dependencies: + semver: "npm:^7.3.5" + checksum: 10c0/c90935d5ce670c87b6b14fab04a965a3b8137e585f8b2a6257263bd7f97756dd736cb165bb470e5156a9e718ecd99413dccc54b1138c1a46d6ec7cf325982fe5 + languageName: node + linkType: hard + +"@pkgjs/parseargs@npm:^0.11.0": + version: 0.11.0 + resolution: "@pkgjs/parseargs@npm:0.11.0" + checksum: 10c0/5bd7576bb1b38a47a7fc7b51ac9f38748e772beebc56200450c4a817d712232b8f1d3ef70532c80840243c657d491cf6a6be1e3a214cff907645819fdc34aadd + languageName: node + linkType: hard + +"@react-aria/autocomplete@npm:3.0.0-rc.1": + version: 3.0.0-rc.1 + resolution: "@react-aria/autocomplete@npm:3.0.0-rc.1" + dependencies: + "@react-aria/combobox": "npm:^3.13.2" + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/listbox": "npm:^3.14.8" + "@react-aria/searchfield": "npm:^3.8.8" + "@react-aria/textfield": "npm:^3.18.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/autocomplete": "npm:3.0.0-beta.3" + "@react-stately/combobox": "npm:^3.11.1" + "@react-types/autocomplete": "npm:3.0.0-alpha.34" + "@react-types/button": "npm:^3.14.0" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/375538f556f833f800ab9c8ebb957dd61fbeda07f6adf062e6a1418affdfd3abe4ef6195de328e76d1afb123650ce1e2670639baf1e79f2fd84a08ac9e9f0397 + languageName: node + linkType: hard + +"@react-aria/breadcrumbs@npm:^3.5.28": + version: 3.5.28 + resolution: "@react-aria/breadcrumbs@npm:3.5.28" + dependencies: + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/link": "npm:^3.8.5" + "@react-aria/utils": "npm:^3.30.1" + "@react-types/breadcrumbs": "npm:^3.7.16" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/ce0948f36a4944b59788d10d34a1cda81ba8d48f9bef9959c4c0dd1e05a24c86f9d0c014b398b804fbe50909334e86801a20f4e559a7faa69a1252881653d506 + languageName: node + linkType: hard + +"@react-aria/button@npm:^3.14.1": + version: 3.14.1 + resolution: "@react-aria/button@npm:3.14.1" + dependencies: + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/toolbar": "npm:3.0.0-beta.20" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/toggle": "npm:^3.9.1" + "@react-types/button": "npm:^3.14.0" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/fde6d70cbc95966094b513de5d2959143e7f027ee88d53bbcca638b0be7c355e79206be1cedce122a890dac74cc49695a9cadf4fba5cc91af37d2a6dfc97176f + languageName: node + linkType: hard + +"@react-aria/calendar@npm:^3.9.1": + version: 3.9.1 + resolution: "@react-aria/calendar@npm:3.9.1" + dependencies: + "@internationalized/date": "npm:^3.9.0" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/live-announcer": "npm:^3.4.4" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/calendar": "npm:^3.8.4" + "@react-types/button": "npm:^3.14.0" + "@react-types/calendar": "npm:^3.7.4" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/0df71500322aad5cded31f1728947cdd4affc4b1199d6b443a0e4132b6c0c0ddc241dc85624e35d6fed658773088d6679e807e2bf3672d4b5891c50e0a0d73a0 + languageName: node + linkType: hard + +"@react-aria/checkbox@npm:^3.16.1": + version: 3.16.1 + resolution: "@react-aria/checkbox@npm:3.16.1" + dependencies: + "@react-aria/form": "npm:^3.1.1" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/label": "npm:^3.7.21" + "@react-aria/toggle": "npm:^3.12.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/checkbox": "npm:^3.7.1" + "@react-stately/form": "npm:^3.2.1" + "@react-stately/toggle": "npm:^3.9.1" + "@react-types/checkbox": "npm:^3.10.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/ab7d10874bd0b0608b9fb8e47985ff5c6bcb810b1ea09ba187a0e8b0840c1d9a03b5d116308698efca84b9b2483517f50d2113d5920cd377c45bebd8e0902d9b + languageName: node + linkType: hard + +"@react-aria/collections@npm:3.0.0-rc.6": + version: 3.0.0-rc.6 + resolution: "@react-aria/collections@npm:3.0.0-rc.6" + dependencies: + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/ssr": "npm:^3.9.10" + "@react-aria/utils": "npm:^3.30.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + use-sync-external-store: "npm:^1.4.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/4daa4c41edc300bfc5c78b5f4c0ed23bc92ac4219cecca7b0a6ac7352a7eac903696514e62ad34e12688bcb3f203c383cceed3a71cb6b871864eeb84a6a634d3 + languageName: node + linkType: hard + +"@react-aria/color@npm:^3.1.1": + version: 3.1.1 + resolution: "@react-aria/color@npm:3.1.1" + dependencies: + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/numberfield": "npm:^3.12.1" + "@react-aria/slider": "npm:^3.8.1" + "@react-aria/spinbutton": "npm:^3.6.18" + "@react-aria/textfield": "npm:^3.18.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-aria/visually-hidden": "npm:^3.8.27" + "@react-stately/color": "npm:^3.9.1" + "@react-stately/form": "npm:^3.2.1" + "@react-types/color": "npm:^3.1.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/bf318d04de679ba169282fa8c57336b8faaed41632895e5d863d5fb8b426bd27ff8516152b0f30360ee6c88602ed840da83dac6d218586575edb18d2c8f14c93 + languageName: node + linkType: hard + +"@react-aria/combobox@npm:^3.13.2": + version: 3.13.2 + resolution: "@react-aria/combobox@npm:3.13.2" + dependencies: + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/listbox": "npm:^3.14.8" + "@react-aria/live-announcer": "npm:^3.4.4" + "@react-aria/menu": "npm:^3.19.2" + "@react-aria/overlays": "npm:^3.29.1" + "@react-aria/selection": "npm:^3.25.1" + "@react-aria/textfield": "npm:^3.18.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/combobox": "npm:^3.11.1" + "@react-stately/form": "npm:^3.2.1" + "@react-types/button": "npm:^3.14.0" + "@react-types/combobox": "npm:^3.13.8" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/b02ed213774d67454d1f5234f444803bd0c4b12ab74614aa5120e8ccc1c08fa109d23a160f1fbc12fc5eaf28cf1173e8b16dcfc457cb75a5238de49f7de210f4 + languageName: node + linkType: hard + +"@react-aria/datepicker@npm:^3.15.1": + version: 3.15.1 + resolution: "@react-aria/datepicker@npm:3.15.1" + dependencies: + "@internationalized/date": "npm:^3.9.0" + "@internationalized/number": "npm:^3.6.5" + "@internationalized/string": "npm:^3.2.7" + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/form": "npm:^3.1.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/label": "npm:^3.7.21" + "@react-aria/spinbutton": "npm:^3.6.18" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/datepicker": "npm:^3.15.1" + "@react-stately/form": "npm:^3.2.1" + "@react-types/button": "npm:^3.14.0" + "@react-types/calendar": "npm:^3.7.4" + "@react-types/datepicker": "npm:^3.13.1" + "@react-types/dialog": "npm:^3.5.21" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/36bed73eb30ac3a24ae5bb3866dc2b25f9362be45ae3dca0cc30f122dd8787ee8aa2e3279846abee26940b68e471466db9e3acd321a39f59c046f8abda7681b1 + languageName: node + linkType: hard + +"@react-aria/dialog@npm:^3.5.30": + version: 3.5.30 + resolution: "@react-aria/dialog@npm:3.5.30" + dependencies: + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/overlays": "npm:^3.29.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-types/dialog": "npm:^3.5.21" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/d7b739731b543386a47ac4920cd9b66892604062626930c4befe1e430a849d13e14a3f2ca0b9db5bf257e7d581e57da2bc71e356525c32ce7df6e0a292e4870c + languageName: node + linkType: hard + +"@react-aria/disclosure@npm:^3.0.8": + version: 3.0.8 + resolution: "@react-aria/disclosure@npm:3.0.8" + dependencies: + "@react-aria/ssr": "npm:^3.9.10" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/disclosure": "npm:^3.0.7" + "@react-types/button": "npm:^3.14.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/ec110787e77c3b95ce694251cf7278b651cd50c99effeff805691258aad7abbb4b899f6687327a3ee0a7bc95af96d592a5359baa584437dac1da6ed9315dacb9 + languageName: node + linkType: hard + +"@react-aria/dnd@npm:^3.11.2": + version: 3.11.2 + resolution: "@react-aria/dnd@npm:3.11.2" + dependencies: + "@internationalized/string": "npm:^3.2.7" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/live-announcer": "npm:^3.4.4" + "@react-aria/overlays": "npm:^3.29.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/dnd": "npm:^3.7.0" + "@react-types/button": "npm:^3.14.0" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/a714b5acc58c3cecc5cb620c15f5f07a817e556459747c31512a8ee8d0a622563c0ca8a1e29354d5001b7ef34ac7b37845514ed24c9db240145e55652508979b + languageName: node + linkType: hard + +"@react-aria/focus@npm:^3.21.1": + version: 3.21.1 + resolution: "@react-aria/focus@npm:3.21.1" + dependencies: + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/utils": "npm:^3.30.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + clsx: "npm:^2.0.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/9271132d9b215f916a19fa72a8a15eb68dc15a73ed8f9fc41096166c703a27336a1d908e3d55cd95de7eac234037abe3ff1fe2a33f15fc48934e9dd8cb97ff48 + languageName: node + linkType: hard + +"@react-aria/form@npm:^3.1.1": + version: 3.1.1 + resolution: "@react-aria/form@npm:3.1.1" + dependencies: + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/form": "npm:^3.2.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/34872e8b30e2e407311e94bc6104af360f8795eaf7c66600c0de2a7c842d5aacc65628493fde92be0b578206761d720088150b12c2b9243032795c5a0b50d3fe + languageName: node + linkType: hard + +"@react-aria/grid@npm:^3.14.4": + version: 3.14.4 + resolution: "@react-aria/grid@npm:3.14.4" + dependencies: + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/live-announcer": "npm:^3.4.4" + "@react-aria/selection": "npm:^3.25.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/grid": "npm:^3.11.5" + "@react-stately/selection": "npm:^3.20.5" + "@react-types/checkbox": "npm:^3.10.1" + "@react-types/grid": "npm:^3.3.5" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/f7cf1586b2c1da0b3e1e3ea66bc1b94d54329815ffba38d069c129fb3c1e724d39d3a1b37f6f7fa3dc58e6203ad3692ac35524d7b9dad926111446fc00fa4985 + languageName: node + linkType: hard + +"@react-aria/gridlist@npm:^3.14.0": + version: 3.14.0 + resolution: "@react-aria/gridlist@npm:3.14.0" + dependencies: + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/grid": "npm:^3.14.4" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/selection": "npm:^3.25.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/list": "npm:^3.13.0" + "@react-stately/tree": "npm:^3.9.2" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/b5eec01376889c04b45738eb6e354b87d380367fbb7b65d9835d5807d799246c7f8b4443ce5aa577050c0685d72ed2651bc0310065ed09dfbe10dd3215f322e1 + languageName: node + linkType: hard + +"@react-aria/i18n@npm:^3.12.12": + version: 3.12.12 + resolution: "@react-aria/i18n@npm:3.12.12" + dependencies: + "@internationalized/date": "npm:^3.9.0" + "@internationalized/message": "npm:^3.1.8" + "@internationalized/number": "npm:^3.6.5" + "@internationalized/string": "npm:^3.2.7" + "@react-aria/ssr": "npm:^3.9.10" + "@react-aria/utils": "npm:^3.30.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/83e1c4d0f246951ca9da6adf2e2825d50668b31f2de62a23ac04a0d9dd3e874a17e4616c72321a3fca6a99e22460f79fb15dee86637b6c7bea5c00835a076f8a + languageName: node + linkType: hard + +"@react-aria/interactions@npm:^3.25.5": + version: 3.25.5 + resolution: "@react-aria/interactions@npm:3.25.5" + dependencies: + "@react-aria/ssr": "npm:^3.9.10" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/flags": "npm:^3.1.2" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/056875ecc08b085134cc8298d5824ed55ff11433cd240320e14f8514e517d64f02f6a95e414a5304f46488c83090e3d1c138b0cf9cbe5d6fdab4e5a4bad5d727 + languageName: node + linkType: hard + +"@react-aria/label@npm:^3.7.21": + version: 3.7.21 + resolution: "@react-aria/label@npm:3.7.21" + dependencies: + "@react-aria/utils": "npm:^3.30.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/34d55f423cd0ca6061453b2feee0dacc6ad70f7ddea7922615287a11283c8fc053e89e7425b2f2ca3d7e1a077b1bcedf5a2b4c6e95e8c7a203756b6703ffbd78 + languageName: node + linkType: hard + +"@react-aria/landmark@npm:^3.0.6": + version: 3.0.6 + resolution: "@react-aria/landmark@npm:3.0.6" + dependencies: + "@react-aria/utils": "npm:^3.30.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + use-sync-external-store: "npm:^1.4.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/ab5413e32d2fc21090ae39fd4414d00b37d56afec715d8715ad285d59f41f454547bf94919f386aa4c447723c1f817a0b47f4cb39c03c64b5211f4c105270453 + languageName: node + linkType: hard + +"@react-aria/link@npm:^3.8.5": + version: 3.8.5 + resolution: "@react-aria/link@npm:3.8.5" + dependencies: + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/utils": "npm:^3.30.1" + "@react-types/link": "npm:^3.6.4" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/cda1ac2c75f950745510bcc536ce4aab5f9f95e0310ad040070ff21ae2c42409eaab262ea4f69ad419f0044d78fcfe91e7224c8b87e779afc106dab7457e5d9a + languageName: node + linkType: hard + +"@react-aria/listbox@npm:^3.14.8": + version: 3.14.8 + resolution: "@react-aria/listbox@npm:3.14.8" + dependencies: + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/label": "npm:^3.7.21" + "@react-aria/selection": "npm:^3.25.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/list": "npm:^3.13.0" + "@react-types/listbox": "npm:^3.7.3" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/48f64c99047a94bb272027891f8840587b7e889d5c17bf772baea28d945d21a5d8e63217fa61bf45cc21e4c70f7dbcb759d4d97761318b402ba025ff42208c60 + languageName: node + linkType: hard + +"@react-aria/live-announcer@npm:^3.4.4": + version: 3.4.4 + resolution: "@react-aria/live-announcer@npm:3.4.4" + dependencies: + "@swc/helpers": "npm:^0.5.0" + checksum: 10c0/1598372e773ee8dbb2f1d2a946652384f5140ab54106416e2a182c72eaabc1b3739e624bac7aea3d95429ba16487074c782ff90db093be36dd1d4cf84f9f9a17 + languageName: node + linkType: hard + +"@react-aria/menu@npm:^3.19.2": + version: 3.19.2 + resolution: "@react-aria/menu@npm:3.19.2" + dependencies: + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/overlays": "npm:^3.29.1" + "@react-aria/selection": "npm:^3.25.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/menu": "npm:^3.9.7" + "@react-stately/selection": "npm:^3.20.5" + "@react-stately/tree": "npm:^3.9.2" + "@react-types/button": "npm:^3.14.0" + "@react-types/menu": "npm:^3.10.4" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/3592ff723178ec8f98f8cfde9bb8d4626daf553c5683b88b435e3275713b9b0ff0f26e9df00d8957423f0712e61799aa4a606f9f610950ae6e9ab72ab8772ed3 + languageName: node + linkType: hard + +"@react-aria/meter@npm:^3.4.26": + version: 3.4.26 + resolution: "@react-aria/meter@npm:3.4.26" + dependencies: + "@react-aria/progress": "npm:^3.4.26" + "@react-types/meter": "npm:^3.4.12" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/5e88247ef1e0a8a0141f6aae07da748dd03814eded8627cd392d8b7335616680486676f7212f05d6a797550b0b4bcfa306d2bbd94cb155a7340829a65bc4e9e5 + languageName: node + linkType: hard + +"@react-aria/numberfield@npm:^3.12.1": + version: 3.12.1 + resolution: "@react-aria/numberfield@npm:3.12.1" + dependencies: + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/spinbutton": "npm:^3.6.18" + "@react-aria/textfield": "npm:^3.18.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/form": "npm:^3.2.1" + "@react-stately/numberfield": "npm:^3.10.1" + "@react-types/button": "npm:^3.14.0" + "@react-types/numberfield": "npm:^3.8.14" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/333f860a5c12692fb7904515950959e2b9bf175a1db5acddbbd206081ad1106ea41e46d94336704a9bf199b0fca0faf591fda79682ed59cb6fd340d0f3bb2fae + languageName: node + linkType: hard + +"@react-aria/overlays@npm:^3.29.1": + version: 3.29.1 + resolution: "@react-aria/overlays@npm:3.29.1" + dependencies: + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/ssr": "npm:^3.9.10" + "@react-aria/utils": "npm:^3.30.1" + "@react-aria/visually-hidden": "npm:^3.8.27" + "@react-stately/overlays": "npm:^3.6.19" + "@react-types/button": "npm:^3.14.0" + "@react-types/overlays": "npm:^3.9.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/e69f2178cbbd30bd43373ca4dcb68edf275dae57926912c2845bd109b0ddf5820e28e8882df049ce188a42a1690ae7a31795d0be8895318b80478c61baf8af4c + languageName: node + linkType: hard + +"@react-aria/progress@npm:^3.4.26": + version: 3.4.26 + resolution: "@react-aria/progress@npm:3.4.26" + dependencies: + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/label": "npm:^3.7.21" + "@react-aria/utils": "npm:^3.30.1" + "@react-types/progress": "npm:^3.5.15" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/1d41424898c39c8c20b3943d3572367f2d3c937a48c8d4167f4874b31e03c4e894a21314729f44cfcbf6283c95a260111152b07d5fc570d86b6bbde785f7f1bf + languageName: node + linkType: hard + +"@react-aria/radio@npm:^3.12.1": + version: 3.12.1 + resolution: "@react-aria/radio@npm:3.12.1" + dependencies: + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/form": "npm:^3.1.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/label": "npm:^3.7.21" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/radio": "npm:^3.11.1" + "@react-types/radio": "npm:^3.9.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/2c8625ce2214142c09af2f5a751a5d390dda6ef3148055973dc8ea71504e631ca0dc5e7d7202e557235c3175dad74b75a4c9440ce3de15d8f07a3b5a55571773 + languageName: node + linkType: hard + +"@react-aria/searchfield@npm:^3.8.8": + version: 3.8.8 + resolution: "@react-aria/searchfield@npm:3.8.8" + dependencies: + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/textfield": "npm:^3.18.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/searchfield": "npm:^3.5.15" + "@react-types/button": "npm:^3.14.0" + "@react-types/searchfield": "npm:^3.6.5" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/72a55f3695762aec4da83240d5c3dc1e501f3b2520b3db3aa74d94e7b5981b6909a542b6f589f299f2d76538732b5ad814c86ab704c378d22ee5b3251b5682ba + languageName: node + linkType: hard + +"@react-aria/select@npm:^3.16.2": + version: 3.16.2 + resolution: "@react-aria/select@npm:3.16.2" + dependencies: + "@react-aria/form": "npm:^3.1.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/label": "npm:^3.7.21" + "@react-aria/listbox": "npm:^3.14.8" + "@react-aria/menu": "npm:^3.19.2" + "@react-aria/selection": "npm:^3.25.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-aria/visually-hidden": "npm:^3.8.27" + "@react-stately/select": "npm:^3.7.1" + "@react-types/button": "npm:^3.14.0" + "@react-types/select": "npm:^3.10.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/c9ead86371cc583dcda11b1316df2f897c4cd618291302346d2980010196aa618f86a4ce5759ace539d144fc0f38fd8f380f6015af5160cc6fb5a27f7b2b6995 + languageName: node + linkType: hard + +"@react-aria/selection@npm:^3.25.1": + version: 3.25.1 + resolution: "@react-aria/selection@npm:3.25.1" + dependencies: + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/selection": "npm:^3.20.5" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/7212dfc3280167c5f87256bbc580c3f05e1a8388d93ce5d66090778b67b7a3bcb49c522172a1a062c0c237204e1d85e6a9cb8ae6095725ed7f1e194ba277ed0e + languageName: node + linkType: hard + +"@react-aria/separator@npm:^3.4.12": + version: 3.4.12 + resolution: "@react-aria/separator@npm:3.4.12" + dependencies: + "@react-aria/utils": "npm:^3.30.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/fa808a76b35ef663a0ff6745562b1238655e9112c27c3243a4334ad1d298f3ba3bb19eb551b8e96e52b23a9500a660fb8fdc8dd292f067b34a9200cb92792a8b + languageName: node + linkType: hard + +"@react-aria/slider@npm:^3.8.1": + version: 3.8.1 + resolution: "@react-aria/slider@npm:3.8.1" + dependencies: + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/label": "npm:^3.7.21" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/slider": "npm:^3.7.1" + "@react-types/shared": "npm:^3.32.0" + "@react-types/slider": "npm:^3.8.1" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/1282cc395fcc531b35a94bb769d5cc462224f20fd876d96fabc432a40201eae9d01a87d6f8fdedc7382d3a1928eac9579aa9f6cc875461abd5bc8ae1c0bffd62 + languageName: node + linkType: hard + +"@react-aria/spinbutton@npm:^3.6.18": + version: 3.6.18 + resolution: "@react-aria/spinbutton@npm:3.6.18" + dependencies: + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/live-announcer": "npm:^3.4.4" + "@react-aria/utils": "npm:^3.30.1" + "@react-types/button": "npm:^3.14.0" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/c9fdd24fe563e450130bb1e3ae7f09f9fc2728120feea965be413d4b1cf10eb2790bf13783dbf8247fc241d9691d12bcb77ea88f656966092f520d22c9eb6da5 + languageName: node + linkType: hard + +"@react-aria/ssr@npm:^3.9.10": + version: 3.9.10 + resolution: "@react-aria/ssr@npm:3.9.10" + dependencies: + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/44acb4c441d9c5d65aab94aa81fd8368413cf2958ab458582296dd78f6ba4783583f2311fa986120060e5c26b54b1f01e8910ffd17e4f41ccc5fc8c357d84089 + languageName: node + linkType: hard + +"@react-aria/switch@npm:^3.7.7": + version: 3.7.7 + resolution: "@react-aria/switch@npm:3.7.7" + dependencies: + "@react-aria/toggle": "npm:^3.12.1" + "@react-stately/toggle": "npm:^3.9.1" + "@react-types/shared": "npm:^3.32.0" + "@react-types/switch": "npm:^3.5.14" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/386dd60efad6544e8bb03393c13d712e47aa68e3169a3d865375831e5353c8e5e849903ea51af09ae40eb1ae206df5c9b8854ce8601e81a7d21fd952bc18c8a2 + languageName: node + linkType: hard + +"@react-aria/table@npm:^3.17.7": + version: 3.17.7 + resolution: "@react-aria/table@npm:3.17.7" + dependencies: + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/grid": "npm:^3.14.4" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/live-announcer": "npm:^3.4.4" + "@react-aria/utils": "npm:^3.30.1" + "@react-aria/visually-hidden": "npm:^3.8.27" + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/flags": "npm:^3.1.2" + "@react-stately/table": "npm:^3.15.0" + "@react-types/checkbox": "npm:^3.10.1" + "@react-types/grid": "npm:^3.3.5" + "@react-types/shared": "npm:^3.32.0" + "@react-types/table": "npm:^3.13.3" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/ee09d8827929df9be0fdf313c22518f82a7e91669c2e6bb6754f6fbd4f656366d9fa86afc290c73e827ec8fb0574bcab19b35b385e7c16d28713569e20c91b6b + languageName: node + linkType: hard + +"@react-aria/tabs@npm:^3.10.7": + version: 3.10.7 + resolution: "@react-aria/tabs@npm:3.10.7" + dependencies: + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/selection": "npm:^3.25.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/tabs": "npm:^3.8.5" + "@react-types/shared": "npm:^3.32.0" + "@react-types/tabs": "npm:^3.3.18" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/ace9e245e0d8d9bf8a1e79a6e31a48dcc8c4604d8c3143c456a29a499eb39c484d4b2470b025f2c0adf86e531140f1c673df44ec012bd32704eb573fcd5a3ee1 + languageName: node + linkType: hard + +"@react-aria/tag@npm:^3.7.1": + version: 3.7.1 + resolution: "@react-aria/tag@npm:3.7.1" + dependencies: + "@react-aria/gridlist": "npm:^3.14.0" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/label": "npm:^3.7.21" + "@react-aria/selection": "npm:^3.25.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/list": "npm:^3.13.0" + "@react-types/button": "npm:^3.14.0" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/d7066939ca4d083f0dd651ca0884851601a920a6609741ec2ce088b52658d5b3b82481fe3acaf3e2522e2d37f5f6cde27e744386b5a4c354318780a23efad567 + languageName: node + linkType: hard + +"@react-aria/textfield@npm:^3.18.1": + version: 3.18.1 + resolution: "@react-aria/textfield@npm:3.18.1" + dependencies: + "@react-aria/form": "npm:^3.1.1" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/label": "npm:^3.7.21" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/form": "npm:^3.2.1" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/shared": "npm:^3.32.0" + "@react-types/textfield": "npm:^3.12.5" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/c596e2414fd64d2354e7dc5f56c959ed033f465e4dce20b602efab9c35bbabe27bcc2e80ef213ab1aa2ff541adcb33c0c967b530f32dd3280a627c317331f5b8 + languageName: node + linkType: hard + +"@react-aria/toast@npm:^3.0.7": + version: 3.0.7 + resolution: "@react-aria/toast@npm:3.0.7" + dependencies: + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/landmark": "npm:^3.0.6" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/toast": "npm:^3.1.2" + "@react-types/button": "npm:^3.14.0" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/83f2dc36c312150724bc4b669917374bf042156a8e4c9cd67a9c8a7e3250c43f97d7e75ddeaa4190474606323ee1239431b929019b919a8645273770c7c2d803 + languageName: node + linkType: hard + +"@react-aria/toggle@npm:^3.12.1": + version: 3.12.1 + resolution: "@react-aria/toggle@npm:3.12.1" + dependencies: + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/toggle": "npm:^3.9.1" + "@react-types/checkbox": "npm:^3.10.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/3ace07768327c7d86f57d7bcf22a60d64c84f7d9adef66e80db2194d237f82016a635903417289eaa7408caca74fee094b8e9dc7ac7d923823b63eabcc094b38 + languageName: node + linkType: hard + +"@react-aria/toolbar@npm:3.0.0-beta.20": + version: 3.0.0-beta.20 + resolution: "@react-aria/toolbar@npm:3.0.0-beta.20" + dependencies: + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/utils": "npm:^3.30.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/af186a16ba6d55b6fd80988ae95031e04bcfcd20bdedb02f12007f5f3c4ef1ace515a0d71d0191544c333bb181df8dfe33f89e52fde7ad83148172561d0c4049 + languageName: node + linkType: hard + +"@react-aria/tooltip@npm:^3.8.7": + version: 3.8.7 + resolution: "@react-aria/tooltip@npm:3.8.7" + dependencies: + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/tooltip": "npm:^3.5.7" + "@react-types/shared": "npm:^3.32.0" + "@react-types/tooltip": "npm:^3.4.20" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/481ec2ee3d43ecae62c01f0c0a1122c735dfaddffbc8db5e4d38963201d4ecc2f66df50d27c97cc93b5480998d545480ec962282f3cf702f220e22ee3e443b73 + languageName: node + linkType: hard + +"@react-aria/tree@npm:^3.1.3": + version: 3.1.3 + resolution: "@react-aria/tree@npm:3.1.3" + dependencies: + "@react-aria/gridlist": "npm:^3.14.0" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/selection": "npm:^3.25.1" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/tree": "npm:^3.9.2" + "@react-types/button": "npm:^3.14.0" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/01b63f94951bbc8797437c27478552b945c107f580c04f2da8aac0f43ea8730ebe750c7a3b1acaf1c79066f6ef24425adff8f977e5cfe2dfe856abc2872ac604 + languageName: node + linkType: hard + +"@react-aria/utils@npm:^3.30.1": + version: 3.30.1 + resolution: "@react-aria/utils@npm:3.30.1" + dependencies: + "@react-aria/ssr": "npm:^3.9.10" + "@react-stately/flags": "npm:^3.1.2" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + clsx: "npm:^2.0.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/3417a3ea7250c4ad23e6943117eb304a3708859fe8c738e0bee39edaefe7a7b82cedecc564f1a7f7fdf715ad13f57804a0b7c015a75fefdecbe3ecd7162f3e2f + languageName: node + linkType: hard + +"@react-aria/virtualizer@npm:^4.1.9": + version: 4.1.9 + resolution: "@react-aria/virtualizer@npm:4.1.9" + dependencies: + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/utils": "npm:^3.30.1" + "@react-stately/virtualizer": "npm:^4.4.3" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/adfd45a5e328c5dfc9abc6167bfb2e06ff3d8a688a8c2901a5b5cb7fe2b7d688537d1c13e0dddf348dc9adc26c1c498329bc68afb831a590a96952aa7141f655 + languageName: node + linkType: hard + +"@react-aria/visually-hidden@npm:^3.8.27": + version: 3.8.27 + resolution: "@react-aria/visually-hidden@npm:3.8.27" + dependencies: + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/utils": "npm:^3.30.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/b9c1e64c9560ec6ff5e186502cc4c89f366d17d8ccd0487c698b22358b0583385f404c567861497cb4c0b035b3906993f700fc219040519b0ce9be1f69d74b24 + languageName: node + linkType: hard + +"@react-stately/autocomplete@npm:3.0.0-beta.3": + version: 3.0.0-beta.3 + resolution: "@react-stately/autocomplete@npm:3.0.0-beta.3" + dependencies: + "@react-stately/utils": "npm:^3.10.8" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/e3c07424f298746783b50bba8b366ca5262431c28b257239f2a91285578182991f0d5472afb596e83f32369e29fd5f84062383e604b17a6f0145537ded202ed5 + languageName: node + linkType: hard + +"@react-stately/calendar@npm:^3.8.4": + version: 3.8.4 + resolution: "@react-stately/calendar@npm:3.8.4" + dependencies: + "@internationalized/date": "npm:^3.9.0" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/calendar": "npm:^3.7.4" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/ce7d212735b94d2ad8a0a2bd6c552f2aa6883b6d4ce34a2d9c8989536845d15bc90aabb66665ff4932eb32d2b43fe15602c5503c35edd05fa567348582b8ab16 + languageName: node + linkType: hard + +"@react-stately/checkbox@npm:^3.7.1": + version: 3.7.1 + resolution: "@react-stately/checkbox@npm:3.7.1" + dependencies: + "@react-stately/form": "npm:^3.2.1" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/checkbox": "npm:^3.10.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/283d7e5aa63761c956fc48c42d12e5dee779c362013afabd36e086f530b4b8137966e6769421951c28cbffa4e793c0ce857de5aea85403a42688f0898f2503fa + languageName: node + linkType: hard + +"@react-stately/collections@npm:^3.12.7": + version: 3.12.7 + resolution: "@react-stately/collections@npm:3.12.7" + dependencies: + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/9f8e2f34a7e8a9630699ca91d8d5f215468b2a669df4e06bfd337d365d52df9b2e42b983d18f2023b746e30f0b06ee76e5838e1067299935ce78fab1c2c959c1 + languageName: node + linkType: hard + +"@react-stately/color@npm:^3.9.1": + version: 3.9.1 + resolution: "@react-stately/color@npm:3.9.1" + dependencies: + "@internationalized/number": "npm:^3.6.5" + "@internationalized/string": "npm:^3.2.7" + "@react-stately/form": "npm:^3.2.1" + "@react-stately/numberfield": "npm:^3.10.1" + "@react-stately/slider": "npm:^3.7.1" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/color": "npm:^3.1.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/1d1833e7c20758318b80f19b1d9fa97eebe47a81089d4dbc05fe41dc9d82e8fc0e32a5cab28005429b145401384a648393e1a673e04869e655979b9f48a0fdb0 + languageName: node + linkType: hard + +"@react-stately/combobox@npm:^3.11.1": + version: 3.11.1 + resolution: "@react-stately/combobox@npm:3.11.1" + dependencies: + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/form": "npm:^3.2.1" + "@react-stately/list": "npm:^3.13.0" + "@react-stately/overlays": "npm:^3.6.19" + "@react-stately/select": "npm:^3.7.1" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/combobox": "npm:^3.13.8" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/d89f22d54f96e829a70e6700904a163d30766767567964ab29b78772b6bbe4f2abbe85ccd0a25b5d8a54a6c60e1d653215699b19d82d84b6620c9e5d73f9fe10 + languageName: node + linkType: hard + +"@react-stately/data@npm:^3.14.0": + version: 3.14.0 + resolution: "@react-stately/data@npm:3.14.0" + dependencies: + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/264de3396ba49e60b02c9fc204b2150c42cf72659e05ce27bf85d6c5a426b2447c6744d4fd824083a486e58c679428afdadebaffce76ab8001d2981683ef201a + languageName: node + linkType: hard + +"@react-stately/datepicker@npm:^3.15.1": + version: 3.15.1 + resolution: "@react-stately/datepicker@npm:3.15.1" + dependencies: + "@internationalized/date": "npm:^3.9.0" + "@internationalized/string": "npm:^3.2.7" + "@react-stately/form": "npm:^3.2.1" + "@react-stately/overlays": "npm:^3.6.19" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/datepicker": "npm:^3.13.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/65167c563757d30a80656081ac51335a1c3f5b7b587dd4702bd28983b5a9a9cb7ce24b34e9e4a77ec7b6cc5dcd59748e4ec067ebba93e3b1a2709f9625e5f13b + languageName: node + linkType: hard + +"@react-stately/disclosure@npm:^3.0.7": + version: 3.0.7 + resolution: "@react-stately/disclosure@npm:3.0.7" + dependencies: + "@react-stately/utils": "npm:^3.10.8" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/2cba308fea9af713a1560c2f2b62323a08c325f6a0ce2ea35fea96f94f352aa17cd8b4666c2e91a46496d50974fc5580a6536a312eac23b0e14ad9dfc6303a42 + languageName: node + linkType: hard + +"@react-stately/dnd@npm:^3.7.0": + version: 3.7.0 + resolution: "@react-stately/dnd@npm:3.7.0" + dependencies: + "@react-stately/selection": "npm:^3.20.5" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/179961eada46bcd884dc48bf29230350f8361c87d578582006e67233a56b47e112d6eb316d5297562b1bd39413782d32b364121a1d9d39710d88b78298fb140e + languageName: node + linkType: hard + +"@react-stately/flags@npm:^3.1.2": + version: 3.1.2 + resolution: "@react-stately/flags@npm:3.1.2" + dependencies: + "@swc/helpers": "npm:^0.5.0" + checksum: 10c0/d86890ce662f04c7d8984e9560527f46c9779b97757abded9e1bf7e230a6900a0ea7a3e7c22534de8d2ff278abae194e4e4ad962d710f3b04c52a4e1011c2e5b + languageName: node + linkType: hard + +"@react-stately/form@npm:^3.2.1": + version: 3.2.1 + resolution: "@react-stately/form@npm:3.2.1" + dependencies: + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/9aa4c38001ea7811fc65677f04ffdaecf03be75bd9da911754d2510ef30be1b83fc45ef023660727bfdaf2f24dcebaa5587ca1ca4f5e1bc7aeb2319b3768c2c2 + languageName: node + linkType: hard + +"@react-stately/grid@npm:^3.11.5": + version: 3.11.5 + resolution: "@react-stately/grid@npm:3.11.5" + dependencies: + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/selection": "npm:^3.20.5" + "@react-types/grid": "npm:^3.3.5" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/bacfde659d10815a435cf0c8333a15da9ff1629483fa32c2263ebb1975ee1b8de21e1768f136c0dc6db8e7e60fac6d7ae72f610915d1b147716d47022a1f35c9 + languageName: node + linkType: hard + +"@react-stately/layout@npm:^4.5.0": + version: 4.5.0 + resolution: "@react-stately/layout@npm:4.5.0" + dependencies: + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/table": "npm:^3.15.0" + "@react-stately/virtualizer": "npm:^4.4.3" + "@react-types/grid": "npm:^3.3.5" + "@react-types/shared": "npm:^3.32.0" + "@react-types/table": "npm:^3.13.3" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/f03bd4fd4aed29b14172250aeecc4cd70f2c686106825c0c85d362583c1ba8b8b99b20f3d227b6e17b13b4446c315eaa95cf09c243e4cbf86a610080f5e667d6 + languageName: node + linkType: hard + +"@react-stately/list@npm:^3.13.0": + version: 3.13.0 + resolution: "@react-stately/list@npm:3.13.0" + dependencies: + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/selection": "npm:^3.20.5" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/d408513e6b984ce912bb744b4da04222c0fa1a57e11fe53976c42df6d7126d3945fc65caaf8d67587ccaf2dce147658de432ddaa80e5b2b0b49012f7b572f810 + languageName: node + linkType: hard + +"@react-stately/menu@npm:^3.9.7": + version: 3.9.7 + resolution: "@react-stately/menu@npm:3.9.7" + dependencies: + "@react-stately/overlays": "npm:^3.6.19" + "@react-types/menu": "npm:^3.10.4" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/4ad5b7da2f6c09efcb459f77bab624be65d37ba6b72cf76c704e28361f9ee6f598365728f351aa15dc27bdb2dca8e1c634e0cf131f036fc5aafd308a2d0c111f + languageName: node + linkType: hard + +"@react-stately/numberfield@npm:^3.10.1": + version: 3.10.1 + resolution: "@react-stately/numberfield@npm:3.10.1" + dependencies: + "@internationalized/number": "npm:^3.6.5" + "@react-stately/form": "npm:^3.2.1" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/numberfield": "npm:^3.8.14" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/1e7eb49fa1e135368bbc4f2e795be70f9db38d049139ce7efd988cddf0b01290527780ab0123b5c953a21991ffdafc76f5cc2cf1c09d68a91b18bdaec810f1ba + languageName: node + linkType: hard + +"@react-stately/overlays@npm:^3.6.19": + version: 3.6.19 + resolution: "@react-stately/overlays@npm:3.6.19" + dependencies: + "@react-stately/utils": "npm:^3.10.8" + "@react-types/overlays": "npm:^3.9.1" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/bc6749850313185a927f3d2f72e8e155d8452a4ec9f19ff3df7c167c6a60a29d91dd97e0b5d5f78ed8fa1a0b275cbfc4f5b135dbd37412246e0cc647499d4cde + languageName: node + linkType: hard + +"@react-stately/radio@npm:^3.11.1": + version: 3.11.1 + resolution: "@react-stately/radio@npm:3.11.1" + dependencies: + "@react-stately/form": "npm:^3.2.1" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/radio": "npm:^3.9.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/f9e59f90f54507da594ef54df96d99cc2baa36e999674aed1950288dc29a5c5ef5235e2f90e3c92fe8a63a4963a7b0ccee9652b55e2552865b3029e34c11eaf8 + languageName: node + linkType: hard + +"@react-stately/searchfield@npm:^3.5.15": + version: 3.5.15 + resolution: "@react-stately/searchfield@npm:3.5.15" + dependencies: + "@react-stately/utils": "npm:^3.10.8" + "@react-types/searchfield": "npm:^3.6.5" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/e71cf9eee9b2112662abccf9d3a1af11693b9251db265a1312f2ba3a943a8dd9c824b9a0a797b37cc636838a6a0a6eca28d1d2ce17bf08b979cf1f98196db27c + languageName: node + linkType: hard + +"@react-stately/select@npm:^3.7.1": + version: 3.7.1 + resolution: "@react-stately/select@npm:3.7.1" + dependencies: + "@react-stately/form": "npm:^3.2.1" + "@react-stately/list": "npm:^3.13.0" + "@react-stately/overlays": "npm:^3.6.19" + "@react-types/select": "npm:^3.10.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/807b870e1bc26ed05b152f10aac3d2c34e66aeab70f01eed472b75edafe10808b03dca45d7ed2273e79b55f7af646a745d0c6a4c61f63067a3a11c5f1f8378c6 languageName: node linkType: hard -"@isaacs/fs-minipass@npm:^4.0.0": - version: 4.0.1 - resolution: "@isaacs/fs-minipass@npm:4.0.1" +"@react-stately/selection@npm:^3.20.5": + version: 3.20.5 + resolution: "@react-stately/selection@npm:3.20.5" dependencies: - minipass: "npm:^7.0.4" - checksum: 10c0/c25b6dc1598790d5b55c0947a9b7d111cfa92594db5296c3b907e2f533c033666f692a3939eadac17b1c7c40d362d0b0635dc874cbfe3e70db7c2b07cc97a5d2 + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/fa3e9440c10d836e48e019ce8811eab2bc38c15e807fec0d1f857ec30f180fa87005f882385259c48fa73d9793c292f3322c35b94df06535fe19eb7b0e715c76 languageName: node linkType: hard -"@istanbuljs/load-nyc-config@npm:^1.0.0": - version: 1.1.0 - resolution: "@istanbuljs/load-nyc-config@npm:1.1.0" +"@react-stately/slider@npm:^3.7.1": + version: 3.7.1 + resolution: "@react-stately/slider@npm:3.7.1" dependencies: - camelcase: "npm:^5.3.1" - find-up: "npm:^4.1.0" - get-package-type: "npm:^0.1.0" - js-yaml: "npm:^3.13.1" - resolve-from: "npm:^5.0.0" - checksum: 10c0/dd2a8b094887da5a1a2339543a4933d06db2e63cbbc2e288eb6431bd832065df0c099d091b6a67436e71b7d6bf85f01ce7c15f9253b4cbebcc3b9a496165ba42 + "@react-stately/utils": "npm:^3.10.8" + "@react-types/shared": "npm:^3.32.0" + "@react-types/slider": "npm:^3.8.1" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/2efd3c3bb50cb5874975ae2019566fc3df443e5f838472b2e56428ecbf184c39710ddb774dc69c856767a95278699a857bcfd3fdd9926ca638d7e4ca80cccc05 languageName: node linkType: hard -"@istanbuljs/schema@npm:^0.1.2": - version: 0.1.3 - resolution: "@istanbuljs/schema@npm:0.1.3" - checksum: 10c0/61c5286771676c9ca3eb2bd8a7310a9c063fb6e0e9712225c8471c582d157392c88f5353581c8c9adbe0dff98892317d2fdfc56c3499aa42e0194405206a963a +"@react-stately/table@npm:^3.15.0": + version: 3.15.0 + resolution: "@react-stately/table@npm:3.15.0" + dependencies: + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/flags": "npm:^3.1.2" + "@react-stately/grid": "npm:^3.11.5" + "@react-stately/selection": "npm:^3.20.5" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/grid": "npm:^3.3.5" + "@react-types/shared": "npm:^3.32.0" + "@react-types/table": "npm:^3.13.3" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/93813ef88a756755fdbb0a92f65d43b7cf83d2029290c34a2e0b337f1e2f25e9ebb7d54b122c4f280dc797ea82550bd0cc105072b7cdec836d5d48d175ea220e languageName: node linkType: hard -"@jridgewell/gen-mapping@npm:^0.3.5": - version: 0.3.8 - resolution: "@jridgewell/gen-mapping@npm:0.3.8" +"@react-stately/tabs@npm:^3.8.5": + version: 3.8.5 + resolution: "@react-stately/tabs@npm:3.8.5" dependencies: - "@jridgewell/set-array": "npm:^1.2.1" - "@jridgewell/sourcemap-codec": "npm:^1.4.10" - "@jridgewell/trace-mapping": "npm:^0.3.24" - checksum: 10c0/c668feaf86c501d7c804904a61c23c67447b2137b813b9ce03eca82cb9d65ac7006d766c218685d76e3d72828279b6ee26c347aa1119dab23fbaf36aed51585a + "@react-stately/list": "npm:^3.13.0" + "@react-types/shared": "npm:^3.32.0" + "@react-types/tabs": "npm:^3.3.18" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/577f4640fbdedd2049c4b2b326ad32c8f9b89366c2e4bffbf5501713a8bc314623f72399ca3e0c112abdebc291d8733f381f34aabf304b87d30d5d29e09b63d9 languageName: node linkType: hard -"@jridgewell/resolve-uri@npm:^3.1.0": +"@react-stately/toast@npm:^3.1.2": version: 3.1.2 - resolution: "@jridgewell/resolve-uri@npm:3.1.2" - checksum: 10c0/d502e6fb516b35032331406d4e962c21fe77cdf1cbdb49c6142bcbd9e30507094b18972778a6e27cbad756209cfe34b1a27729e6fa08a2eb92b33943f680cf1e + resolution: "@react-stately/toast@npm:3.1.2" + dependencies: + "@swc/helpers": "npm:^0.5.0" + use-sync-external-store: "npm:^1.4.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/5de06a2ca5830824a236f809e44a5084ae58a4f463c86aa2e72ec84c8ca632dfe1f5054248a9a1f6ee2aa213e22bfc186e0f4d5ef9a552eb369ee906686f8fec languageName: node linkType: hard -"@jridgewell/set-array@npm:^1.2.1": - version: 1.2.1 - resolution: "@jridgewell/set-array@npm:1.2.1" - checksum: 10c0/2a5aa7b4b5c3464c895c802d8ae3f3d2b92fcbe84ad12f8d0bfbb1f5ad006717e7577ee1fd2eac00c088abe486c7adb27976f45d2941ff6b0b92b2c3302c60f4 +"@react-stately/toggle@npm:^3.9.1": + version: 3.9.1 + resolution: "@react-stately/toggle@npm:3.9.1" + dependencies: + "@react-stately/utils": "npm:^3.10.8" + "@react-types/checkbox": "npm:^3.10.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/d7a87f9b00f324cfd2cab13733ceebaf66df9514024bfa85f7f8bef27ac0037b0568f763e96a4a9b46798fbd90048d8afffc0a6ad38803e121a3251d13bf7113 languageName: node linkType: hard -"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14": - version: 1.5.0 - resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" - checksum: 10c0/2eb864f276eb1096c3c11da3e9bb518f6d9fc0023c78344cdc037abadc725172c70314bdb360f2d4b7bffec7f5d657ce006816bc5d4ecb35e61b66132db00c18 +"@react-stately/tooltip@npm:^3.5.7": + version: 3.5.7 + resolution: "@react-stately/tooltip@npm:3.5.7" + dependencies: + "@react-stately/overlays": "npm:^3.6.19" + "@react-types/tooltip": "npm:^3.4.20" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/fc180cd11b2ba557d64b30e495fc6ab60972b1fcc77924bf7d521d46a0973d8f0e3ff0dd846c031d604c66caac7a1654ad07505b0b577c6f2ac87b62f3e60a4d languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25": - version: 0.3.25 - resolution: "@jridgewell/trace-mapping@npm:0.3.25" +"@react-stately/tree@npm:^3.9.2": + version: 3.9.2 + resolution: "@react-stately/tree@npm:3.9.2" dependencies: - "@jridgewell/resolve-uri": "npm:^3.1.0" - "@jridgewell/sourcemap-codec": "npm:^1.4.14" - checksum: 10c0/3d1ce6ebc69df9682a5a8896b414c6537e428a1d68b02fcc8363b04284a8ca0df04d0ee3013132252ab14f2527bc13bea6526a912ecb5658f0e39fd2860b4df4 + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/selection": "npm:^3.20.5" + "@react-stately/utils": "npm:^3.10.8" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/e2c3eb2eec5c0fdfc18e7cf09c3a866f0ebc261bf3398df7b54fa41c8b233e68ba4366c043896a101ddb72d2786adc5bad00f85eb61d0ff60afec34665de096f languageName: node linkType: hard -"@npmcli/agent@npm:^3.0.0": - version: 3.0.0 - resolution: "@npmcli/agent@npm:3.0.0" +"@react-stately/utils@npm:^3.10.8": + version: 3.10.8 + resolution: "@react-stately/utils@npm:3.10.8" dependencies: - agent-base: "npm:^7.1.0" - http-proxy-agent: "npm:^7.0.0" - https-proxy-agent: "npm:^7.0.1" - lru-cache: "npm:^10.0.1" - socks-proxy-agent: "npm:^8.0.3" - checksum: 10c0/efe37b982f30740ee77696a80c196912c274ecd2cb243bc6ae7053a50c733ce0f6c09fda085145f33ecf453be19654acca74b69e81eaad4c90f00ccffe2f9271 + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/a97cc292986e3eeb2ceb1626671ce60e8342a3ff35ab92bcfcb94bd6b28729836cc592e3fe4df2fba603e5fdd26291be77b7f60441920298c282bb93f424feba languageName: node linkType: hard -"@npmcli/fs@npm:^4.0.0": - version: 4.0.0 - resolution: "@npmcli/fs@npm:4.0.0" +"@react-stately/virtualizer@npm:^4.4.3": + version: 4.4.3 + resolution: "@react-stately/virtualizer@npm:4.4.3" dependencies: - semver: "npm:^7.3.5" - checksum: 10c0/c90935d5ce670c87b6b14fab04a965a3b8137e585f8b2a6257263bd7f97756dd736cb165bb470e5156a9e718ecd99413dccc54b1138c1a46d6ec7cf325982fe5 + "@react-aria/utils": "npm:^3.30.1" + "@react-types/shared": "npm:^3.32.0" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/9e49131a18e968a3119b17bca6826a008ed23074751c2bc564cb6d812ae13825d1368830026b3afbe016a0747658d48997048e53332b500378c6c8a66bc94a30 languageName: node linkType: hard -"@pkgjs/parseargs@npm:^0.11.0": - version: 0.11.0 - resolution: "@pkgjs/parseargs@npm:0.11.0" - checksum: 10c0/5bd7576bb1b38a47a7fc7b51ac9f38748e772beebc56200450c4a817d712232b8f1d3ef70532c80840243c657d491cf6a6be1e3a214cff907645819fdc34aadd +"@react-types/autocomplete@npm:3.0.0-alpha.34": + version: 3.0.0-alpha.34 + resolution: "@react-types/autocomplete@npm:3.0.0-alpha.34" + dependencies: + "@react-types/combobox": "npm:^3.13.8" + "@react-types/searchfield": "npm:^3.6.5" + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/05eca860ccfaa6df0e7a130cc2994cf4d35f1eee4285df94b77ede058687bf415cf98a2424ce1611b562bc7f814a28a27d8d080b3ae36377ebe20a1cf56e2d11 + languageName: node + linkType: hard + +"@react-types/breadcrumbs@npm:^3.7.16": + version: 3.7.16 + resolution: "@react-types/breadcrumbs@npm:3.7.16" + dependencies: + "@react-types/link": "npm:^3.6.4" + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/af033fc8f5f47b926f15154e1f6cceb24a666004a1df058c7c8accb3bc0b916fc28a56a400f10bdb697425119584df7c4f10a985a6400633caa6d05f315d2593 + languageName: node + linkType: hard + +"@react-types/button@npm:^3.14.0": + version: 3.14.0 + resolution: "@react-types/button@npm:3.14.0" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/33891e850e0cccb5326cbd866c9bc7312611e7476ca82a83fee601a516a07a04da1eef1e9dbbf34f56a2f7cfcd546306ae91c088d99cdc548b49b80267e3f623 + languageName: node + linkType: hard + +"@react-types/calendar@npm:^3.7.4": + version: 3.7.4 + resolution: "@react-types/calendar@npm:3.7.4" + dependencies: + "@internationalized/date": "npm:^3.9.0" + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/0e05af84d55170792ae5f937bba3ae1534e25cafb9ff562b9b9485fc93631b887faf1400f2ef3b1fe764efbbdd999847494606cc770bc19c44d7d173601be2f0 + languageName: node + linkType: hard + +"@react-types/checkbox@npm:^3.10.1": + version: 3.10.1 + resolution: "@react-types/checkbox@npm:3.10.1" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/cb2e3d0f4a47c2f664cce06a0956825d80e30d8c30e4d80fd6d657822dbbdee0d46f49d93c1f31d4919bbe2d69b09556d8185b1e0d4ebd4f658fe431e6a6aa65 + languageName: node + linkType: hard + +"@react-types/color@npm:^3.1.1": + version: 3.1.1 + resolution: "@react-types/color@npm:3.1.1" + dependencies: + "@react-types/shared": "npm:^3.32.0" + "@react-types/slider": "npm:^3.8.1" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/e2c4872a5c6534406356e05742f89f81d76a0114aebc754b381a416c029d08d1c79ad23ac79d3618adcfaace983779780b15009f30afabd48968e89699e3d187 + languageName: node + linkType: hard + +"@react-types/combobox@npm:^3.13.8": + version: 3.13.8 + resolution: "@react-types/combobox@npm:3.13.8" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/539abb36dc9b9de407c80d832933bcf073dc0bd6b11ce5da6a8b2aa279e839dcea713335601fdf45fa9693cdd39b18e1a4b5bc5a19cf5cf780a0449013807e0d + languageName: node + linkType: hard + +"@react-types/datepicker@npm:^3.13.1": + version: 3.13.1 + resolution: "@react-types/datepicker@npm:3.13.1" + dependencies: + "@internationalized/date": "npm:^3.9.0" + "@react-types/calendar": "npm:^3.7.4" + "@react-types/overlays": "npm:^3.9.1" + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/e0d61abe97a3a40ce36a0814fb010509e47153416b3c3adb05cb55c6142703c8c837f2fa73fd8d52a19ce7812c3931e75a88818941908ff8a6eb24bf939a8053 + languageName: node + linkType: hard + +"@react-types/dialog@npm:^3.5.21": + version: 3.5.21 + resolution: "@react-types/dialog@npm:3.5.21" + dependencies: + "@react-types/overlays": "npm:^3.9.1" + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/129bbdca319ab5353361f861c973837b73f7ed21cc7a887acb1e528b781ccbf390292bf5c8ca48a425e8b5a14d59d45be708e40a5b5f3aca4404c816a14ad135 + languageName: node + linkType: hard + +"@react-types/form@npm:^3.7.15": + version: 3.7.15 + resolution: "@react-types/form@npm:3.7.15" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/135ce29135bc66277a99840a01916b495dca98d4ce5854f3fa756c7bf891e897b325fc5777047c3e91ab938e73986be482b17ab3d669e083b8b815835c59fa1d + languageName: node + linkType: hard + +"@react-types/grid@npm:^3.3.5": + version: 3.3.5 + resolution: "@react-types/grid@npm:3.3.5" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/4b49af54683ce73ed2ee9be2b6f7a03870ee461bf41f1943f5d88fc4a4cedf62091e9a7937245db10acc0a1e4feedffe579be7e8746a7d71f6483553eed08e55 + languageName: node + linkType: hard + +"@react-types/link@npm:^3.6.4": + version: 3.6.4 + resolution: "@react-types/link@npm:3.6.4" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/69fa28299af26bd1473933dffd55a932b1a5cbd263898efc16c0fc5cbef02d21201f947e739a63ee26a9f0a311c3ee77a60689004176517558ada4622cfd5f7f + languageName: node + linkType: hard + +"@react-types/listbox@npm:^3.7.3": + version: 3.7.3 + resolution: "@react-types/listbox@npm:3.7.3" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/94fce2d390bfb9beafcc5a241ffe32524512240c7980fafee3195c859973ba84e1df2afc8a55e679d797c74f5d33fa18162fbaeeda983187423f7ce9bfd6d74a + languageName: node + linkType: hard + +"@react-types/menu@npm:^3.10.4": + version: 3.10.4 + resolution: "@react-types/menu@npm:3.10.4" + dependencies: + "@react-types/overlays": "npm:^3.9.1" + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/699da0cac2e31fdc362e8f5e227c2221187e4d883509ae242b1efd58ab28c55c2ee695c227ea04c3a4510354dc3348b409fa13a38b88a91544597cad63eb202b + languageName: node + linkType: hard + +"@react-types/meter@npm:^3.4.12": + version: 3.4.12 + resolution: "@react-types/meter@npm:3.4.12" + dependencies: + "@react-types/progress": "npm:^3.5.15" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/64e1177f43d3df794c339ea6d172d4703ee2084b04df113a453b49f7741a3ba8f5dc04333cf0d0757056f664fd0d005a7a29bb006432671e663a1b92694afedf + languageName: node + linkType: hard + +"@react-types/numberfield@npm:^3.8.14": + version: 3.8.14 + resolution: "@react-types/numberfield@npm:3.8.14" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/1c9c4212a32e87d34eb1fff7a34dd1a7a4f616653087e8cdbe40ddafe6c6424b9a8d0a70076f6fdf88a2736a394de3f2cd697c955a6ca01c8d8c9a9133bc1f8d + languageName: node + linkType: hard + +"@react-types/overlays@npm:^3.9.1": + version: 3.9.1 + resolution: "@react-types/overlays@npm:3.9.1" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/bf0e1c11251e2c6c79e12762d30e886ba5587cd7d38761d4174c3f512ace205cf7b3d7da44ca7fe3797af27ad32b844a6c4ecb3cf0a5c6b9784557cfaf035346 + languageName: node + linkType: hard + +"@react-types/progress@npm:^3.5.15": + version: 3.5.15 + resolution: "@react-types/progress@npm:3.5.15" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/7a5f4b2690fdea608b8b6d8c0ea8c262fc303b0440102ec2873a80fec45558139aeac20c507e6fbbad77686fb7f6c50ee0c4ec26c18d7ea5c7595081bda9b426 + languageName: node + linkType: hard + +"@react-types/radio@npm:^3.9.1": + version: 3.9.1 + resolution: "@react-types/radio@npm:3.9.1" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/1af8c2612cde155082797f225e995bdaab2d7e127edd9b8ec82bee925699c053a106b506022ee12cb0dd52509b10d00dba4d168c89886d58c7b22884ece615d0 + languageName: node + linkType: hard + +"@react-types/searchfield@npm:^3.6.5": + version: 3.6.5 + resolution: "@react-types/searchfield@npm:3.6.5" + dependencies: + "@react-types/shared": "npm:^3.32.0" + "@react-types/textfield": "npm:^3.12.5" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/df9a7fc615e8c1098991550814bfbb67e22290ae89e10876144fdac9bde4156ab64a5c4b8c623184bf0e9f0b7a34855cb35be63d434a24de2ebe802ca5e271d2 + languageName: node + linkType: hard + +"@react-types/select@npm:^3.10.1": + version: 3.10.1 + resolution: "@react-types/select@npm:3.10.1" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/b236419695ace9eb27e3f975d5b45bf6ff7c3c50a07ac7fbdc87ab1ec8bc977bf85187713656c14df1dd9da0b07b04a64b866bfc627e8d9f84bf709f1109f5aa + languageName: node + linkType: hard + +"@react-types/shared@npm:^3.32.0": + version: 3.32.0 + resolution: "@react-types/shared@npm:3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/8484f310a8911ab01daa87f9bfdea0a9a76e152d13d8421c28560dc84d64a7df23cda956db59f7010d2e8eaea27d7644118bfbe60b603499903b5f7e6cdfe4fa + languageName: node + linkType: hard + +"@react-types/slider@npm:^3.8.1": + version: 3.8.1 + resolution: "@react-types/slider@npm:3.8.1" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/c57cd9e7a7e561eaf367ca733c315db2c4132a754a43dd44a4100068bc9e695dadc9b482737f0a11e2991baed79d80ea29bf1cd18df6563b7c54767012ab1bde + languageName: node + linkType: hard + +"@react-types/switch@npm:^3.5.14": + version: 3.5.14 + resolution: "@react-types/switch@npm:3.5.14" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/43318b370863fd9fbc2537c3773dba8e28fb1f4e0d2849f0c115f523f59d8d8e88f59c6ede436fa32f634211e96d7a75b2752ec4bcf87a1edc392b624fab7ddd + languageName: node + linkType: hard + +"@react-types/table@npm:^3.13.3": + version: 3.13.3 + resolution: "@react-types/table@npm:3.13.3" + dependencies: + "@react-types/grid": "npm:^3.3.5" + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/f1d40064f28441ae0387467f29ff01c641a8eb134b0e2d0dcb3b97331bdf56ac8d619e000bbb5a6229a31ddc288884913fcefb1e255f0c2f1c37f30575170b72 + languageName: node + linkType: hard + +"@react-types/tabs@npm:^3.3.18": + version: 3.3.18 + resolution: "@react-types/tabs@npm:3.3.18" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/dd830c08a517e3932d8c694896d5585b639530a7bad2d103b85531b8b4d8bcfde2bba512410260837eb1a0f464cce85d67675d025d56c5c23b30815039e400a0 + languageName: node + linkType: hard + +"@react-types/textfield@npm:^3.12.5": + version: 3.12.5 + resolution: "@react-types/textfield@npm:3.12.5" + dependencies: + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/4770454303a5b3d93afbc93e6d2e026eed62227a71474e791a598458880d2e06d681e9f3b1d586a8108cbb2e4f75ad64a77e5e71b9adb0e70d73bd8f0ee96bab + languageName: node + linkType: hard + +"@react-types/tooltip@npm:^3.4.20": + version: 3.4.20 + resolution: "@react-types/tooltip@npm:3.4.20" + dependencies: + "@react-types/overlays": "npm:^3.9.1" + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/7fd8415658a140db98974225859fc355a81282563b61246897b98ed0afb398eaff1e770b1bafe246aaa2cc4a07485c501ebed9de9a0a3882a20c658ea29ffa6b languageName: node linkType: hard @@ -634,6 +2409,15 @@ __metadata: languageName: node linkType: hard +"@swc/helpers@npm:^0.5.0": + version: 0.5.17 + resolution: "@swc/helpers@npm:0.5.17" + dependencies: + tslib: "npm:^2.8.0" + checksum: 10c0/fe1f33ebb968558c5a0c595e54f2e479e4609bff844f9ca9a2d1ffd8dd8504c26f862a11b031f48f75c95b0381c2966c3dd156e25942f90089badd24341e7dbb + languageName: node + linkType: hard + "@tests/analysis@workspace:tests/analysis_tests/tests": version: 0.0.0-use.local resolution: "@tests/analysis@workspace:tests/analysis_tests/tests" @@ -664,6 +2448,7 @@ __metadata: version: 0.0.0-use.local resolution: "@tests/gentype-genimport-single@workspace:tests/gentype_tests/genimport-single" dependencies: + react-aria-components: "npm:1.12.1" rescript: "workspace:^" typescript: "npm:5.8.2" languageName: unknown @@ -1069,6 +2854,13 @@ __metadata: languageName: node linkType: hard +"client-only@npm:^0.0.1": + version: 0.0.1 + resolution: "client-only@npm:0.0.1" + checksum: 10c0/9d6cfd0c19e1c96a434605added99dff48482152af791ec4172fb912a71cff9027ff174efd8cdb2160cc7f377543e0537ffc462d4f279bc4701de3f2a3c4b358 + languageName: node + linkType: hard + "cliui@npm:^6.0.0": version: 6.0.0 resolution: "cliui@npm:6.0.0" @@ -1091,6 +2883,13 @@ __metadata: languageName: node linkType: hard +"clsx@npm:^2.0.0": + version: 2.1.1 + resolution: "clsx@npm:2.1.1" + checksum: 10c0/c4c8eb865f8c82baab07e71bfa8897c73454881c4f99d6bc81585aecd7c441746c1399d08363dc096c550cceaf97bd4ce1e8854e1771e9998d9f94c4fe075839 + languageName: node + linkType: hard + "color-convert@npm:^2.0.1": version: 2.0.1 resolution: "color-convert@npm:2.0.1" @@ -1186,6 +2985,13 @@ __metadata: languageName: node linkType: hard +"decimal.js@npm:^10.4.3": + version: 10.6.0 + resolution: "decimal.js@npm:10.6.0" + checksum: 10c0/07d69fbcc54167a340d2d97de95f546f9ff1f69d2b45a02fd7a5292412df3cd9eb7e23065e532a318f5474a2e1bccf8392fdf0443ef467f97f3bf8cb0477e5aa + languageName: node + linkType: hard + "deepmerge@npm:^4.2.2": version: 4.3.1 resolution: "deepmerge@npm:4.3.1" @@ -1659,6 +3465,18 @@ __metadata: languageName: node linkType: hard +"intl-messageformat@npm:^10.1.0": + version: 10.7.16 + resolution: "intl-messageformat@npm:10.7.16" + dependencies: + "@formatjs/ecma402-abstract": "npm:2.3.4" + "@formatjs/fast-memoize": "npm:2.2.7" + "@formatjs/icu-messageformat-parser": "npm:2.11.2" + tslib: "npm:^2.8.0" + checksum: 10c0/537735bf6439f0560f132895d117df6839957ac04cdd58d861f6da86803d40bfc19059e3d341ddb8de87214b73a6329b57f9acdb512bb0f745dcf08729507b9b + languageName: node + linkType: hard + "ip-address@npm:^9.0.5": version: 9.0.5 resolution: "ip-address@npm:9.0.5" @@ -2502,6 +4320,99 @@ __metadata: languageName: node linkType: hard +"react-aria-components@npm:1.12.1": + version: 1.12.1 + resolution: "react-aria-components@npm:1.12.1" + dependencies: + "@internationalized/date": "npm:^3.9.0" + "@internationalized/string": "npm:^3.2.7" + "@react-aria/autocomplete": "npm:3.0.0-rc.1" + "@react-aria/collections": "npm:3.0.0-rc.6" + "@react-aria/dnd": "npm:^3.11.2" + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/live-announcer": "npm:^3.4.4" + "@react-aria/overlays": "npm:^3.29.1" + "@react-aria/ssr": "npm:^3.9.10" + "@react-aria/textfield": "npm:^3.18.1" + "@react-aria/toolbar": "npm:3.0.0-beta.20" + "@react-aria/utils": "npm:^3.30.1" + "@react-aria/virtualizer": "npm:^4.1.9" + "@react-stately/autocomplete": "npm:3.0.0-beta.3" + "@react-stately/layout": "npm:^4.5.0" + "@react-stately/selection": "npm:^3.20.5" + "@react-stately/table": "npm:^3.15.0" + "@react-stately/utils": "npm:^3.10.8" + "@react-stately/virtualizer": "npm:^4.4.3" + "@react-types/form": "npm:^3.7.15" + "@react-types/grid": "npm:^3.3.5" + "@react-types/shared": "npm:^3.32.0" + "@react-types/table": "npm:^3.13.3" + "@swc/helpers": "npm:^0.5.0" + client-only: "npm:^0.0.1" + react-aria: "npm:^3.43.1" + react-stately: "npm:^3.41.0" + use-sync-external-store: "npm:^1.4.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/9b48a3b22d0afb45f79a224fa6b786c8761c9f3108e8da298ef66facc86f2446b11d2a20ecf0a173f0d660059a3d50025cd3907e91751ed5d4af0188378d1c7d + languageName: node + linkType: hard + +"react-aria@npm:^3.43.1": + version: 3.43.1 + resolution: "react-aria@npm:3.43.1" + dependencies: + "@internationalized/string": "npm:^3.2.7" + "@react-aria/breadcrumbs": "npm:^3.5.28" + "@react-aria/button": "npm:^3.14.1" + "@react-aria/calendar": "npm:^3.9.1" + "@react-aria/checkbox": "npm:^3.16.1" + "@react-aria/color": "npm:^3.1.1" + "@react-aria/combobox": "npm:^3.13.2" + "@react-aria/datepicker": "npm:^3.15.1" + "@react-aria/dialog": "npm:^3.5.30" + "@react-aria/disclosure": "npm:^3.0.8" + "@react-aria/dnd": "npm:^3.11.2" + "@react-aria/focus": "npm:^3.21.1" + "@react-aria/gridlist": "npm:^3.14.0" + "@react-aria/i18n": "npm:^3.12.12" + "@react-aria/interactions": "npm:^3.25.5" + "@react-aria/label": "npm:^3.7.21" + "@react-aria/landmark": "npm:^3.0.6" + "@react-aria/link": "npm:^3.8.5" + "@react-aria/listbox": "npm:^3.14.8" + "@react-aria/menu": "npm:^3.19.2" + "@react-aria/meter": "npm:^3.4.26" + "@react-aria/numberfield": "npm:^3.12.1" + "@react-aria/overlays": "npm:^3.29.1" + "@react-aria/progress": "npm:^3.4.26" + "@react-aria/radio": "npm:^3.12.1" + "@react-aria/searchfield": "npm:^3.8.8" + "@react-aria/select": "npm:^3.16.2" + "@react-aria/selection": "npm:^3.25.1" + "@react-aria/separator": "npm:^3.4.12" + "@react-aria/slider": "npm:^3.8.1" + "@react-aria/ssr": "npm:^3.9.10" + "@react-aria/switch": "npm:^3.7.7" + "@react-aria/table": "npm:^3.17.7" + "@react-aria/tabs": "npm:^3.10.7" + "@react-aria/tag": "npm:^3.7.1" + "@react-aria/textfield": "npm:^3.18.1" + "@react-aria/toast": "npm:^3.0.7" + "@react-aria/tooltip": "npm:^3.8.7" + "@react-aria/tree": "npm:^3.1.3" + "@react-aria/utils": "npm:^3.30.1" + "@react-aria/visually-hidden": "npm:^3.8.27" + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/cf4e8cc615c687ecd16fdc1a80dba70d5e8e6fa98fde22467b949b4815a03e93600da1157e6aa7658d852000944d965806edc507fd02e7e40dfd1eb62443b3ba + languageName: node + linkType: hard + "react-dom@npm:^18.3.1": version: 18.3.1 resolution: "react-dom@npm:18.3.1" @@ -2514,6 +4425,42 @@ __metadata: languageName: node linkType: hard +"react-stately@npm:^3.41.0": + version: 3.41.0 + resolution: "react-stately@npm:3.41.0" + dependencies: + "@react-stately/calendar": "npm:^3.8.4" + "@react-stately/checkbox": "npm:^3.7.1" + "@react-stately/collections": "npm:^3.12.7" + "@react-stately/color": "npm:^3.9.1" + "@react-stately/combobox": "npm:^3.11.1" + "@react-stately/data": "npm:^3.14.0" + "@react-stately/datepicker": "npm:^3.15.1" + "@react-stately/disclosure": "npm:^3.0.7" + "@react-stately/dnd": "npm:^3.7.0" + "@react-stately/form": "npm:^3.2.1" + "@react-stately/list": "npm:^3.13.0" + "@react-stately/menu": "npm:^3.9.7" + "@react-stately/numberfield": "npm:^3.10.1" + "@react-stately/overlays": "npm:^3.6.19" + "@react-stately/radio": "npm:^3.11.1" + "@react-stately/searchfield": "npm:^3.5.15" + "@react-stately/select": "npm:^3.7.1" + "@react-stately/selection": "npm:^3.20.5" + "@react-stately/slider": "npm:^3.7.1" + "@react-stately/table": "npm:^3.15.0" + "@react-stately/tabs": "npm:^3.8.5" + "@react-stately/toast": "npm:^3.1.2" + "@react-stately/toggle": "npm:^3.9.1" + "@react-stately/tooltip": "npm:^3.5.7" + "@react-stately/tree": "npm:^3.9.2" + "@react-types/shared": "npm:^3.32.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1 + checksum: 10c0/36acef7ad6f0d58bc66804d152c25f31bd2e977b34cc131c6d70af142a20478a9e7d3826d22084ce4abedb94b6c87aa627ee7467337cab7ad5ae0d45b571d6b2 + languageName: node + linkType: hard + "react@npm:^18.3.1": version: 18.3.1 resolution: "react@npm:18.3.1" @@ -3029,7 +4976,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.4.0": +"tslib@npm:^2.4.0, tslib@npm:^2.8.0": version: 2.8.1 resolution: "tslib@npm:2.8.1" checksum: 10c0/9c4759110a19c53f992d9aae23aac5ced636e99887b51b9e61def52611732872ff7668757d4e4c61f19691e36f4da981cd9485e869b4a7408d689f6bf1f14e62 @@ -3111,6 +5058,15 @@ __metadata: languageName: node linkType: hard +"use-sync-external-store@npm:^1.4.0": + version: 1.5.0 + resolution: "use-sync-external-store@npm:1.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + checksum: 10c0/1b8663515c0be34fa653feb724fdcce3984037c78dd4a18f68b2c8be55cc1a1084c578d5b75f158d41b5ddffc2bf5600766d1af3c19c8e329bb20af2ec6f52f4 + languageName: node + linkType: hard + "uuid@npm:^3.3.3": version: 3.4.0 resolution: "uuid@npm:3.4.0" From 20af14e0445f59c8e03daeb781752c2a988b0c00 Mon Sep 17 00:00:00 2001 From: test Date: Mon, 8 Sep 2025 07:53:13 +0200 Subject: [PATCH 04/10] Update gentype outputs to match generator changes --- compiler/gentype/Annotation.ml | 18 --- compiler/gentype/CodeItem.ml | 1 - compiler/gentype/EmitJs.ml | 63 +-------- compiler/gentype/GentypeImportHelper.ml | 21 --- compiler/gentype/TranslateTypeDeclarations.ml | 127 +----------------- compiler/gentype/Translation.ml | 2 +- tests/gentype_tests/genimport-single/Makefile | 35 ++--- .../src/AriaComponents.gen.tsx | 12 +- .../genimport-single/src/AriaComponents.res | 2 +- .../src/GenTypeImportExpectedErrors.gen.tsx | 14 +- .../genimport-single/ts-errors.txt | 5 - .../src/ImportHookDefault.gen.tsx | 2 +- .../src/ImportJsValue.gen.tsx | 28 ++-- .../src/MyInput.gen.tsx | 10 +- .../src/TestFirstClassModules.gen.tsx | 4 +- .../src/TransitiveType1.gen.tsx | 4 +- .../src/TypeParams3.gen.tsx | 4 +- .../src/nested/Types.gen.tsx | 8 +- 18 files changed, 55 insertions(+), 305 deletions(-) delete mode 100644 compiler/gentype/GentypeImportHelper.ml delete mode 100644 tests/gentype_tests/genimport-single/ts-errors.txt diff --git a/compiler/gentype/Annotation.ml b/compiler/gentype/Annotation.ml index 9bafce6975..adb5cdd3ab 100644 --- a/compiler/gentype/Annotation.ml +++ b/compiler/gentype/Annotation.ml @@ -167,24 +167,6 @@ let get_attribute_import_renaming attributes = _ ) -> (* Tuple form encodes (importPath, remoteExportName). Keep remote name separate. *) (Some import_string, gentype_as_renaming, None, Some rename_string) - | Some (_, RecordPayload opts), _ -> - let import_tuple_opt = List.assoc_opt "importPath" opts in - let import_string_opt, rename_string_opt = - match import_tuple_opt with - | Some (TuplePayload [StringPayload import_string; StringPayload rename]) - -> - (Some import_string, Some rename) - | Some (TuplePayload [StringPayload import_string]) -> - (Some import_string, None) - | _ -> (None, None) - in - let exact_opt = - match List.assoc_opt "exact" opts with - | Some (BoolPayload b) -> Some b - | _ -> None - in - (* Keep remote export name separate from local alias (@genType.as) *) - (import_string_opt, gentype_as_renaming, exact_opt, rename_string_opt) | _ -> (None, gentype_as_renaming, None, None) let get_tag attributes = diff --git a/compiler/gentype/CodeItem.ml b/compiler/gentype/CodeItem.ml index 046db706cb..7913263c67 100644 --- a/compiler/gentype/CodeItem.ml +++ b/compiler/gentype/CodeItem.ml @@ -47,7 +47,6 @@ type export_type_map = export_type_item StringMap.t type type_declaration = { export_from_type_declaration: export_from_type_declaration; import_types: import_type list; - expected_type: type_ option; } type t = ExportValue of export_value | ImportValue of import_value diff --git a/compiler/gentype/EmitJs.ml b/compiler/gentype/EmitJs.ml index 77de84668e..9b14490df0 100644 --- a/compiler/gentype/EmitJs.ml +++ b/compiler/gentype/EmitJs.ml @@ -635,57 +635,7 @@ let emit_translation_as_string ~(config : Config.t) ~file_name |> List.map (fun (type_declaration : CodeItem.type_declaration) -> type_declaration.export_from_type_declaration) in - (* Emit a named alias for the ReScript-side expected shape to improve TS errors. *) - let emitters = - let type_name_is_interface = - type_name_is_interface ~export_type_map - ~export_type_map_from_other_files: - initial_env.export_type_map_from_other_files - in - annotated_type_declarations - |> List.fold_left - (fun emitters (td : CodeItem.type_declaration) -> - match td.expected_type with - | None -> emitters - | Some expected - when GentypeImportHelper.should_inline_expected expected -> - emitters - | Some expected -> - let ({CodeItem.export_type} - : CodeItem.export_from_type_declaration) = - td.export_from_type_declaration - in - let alias_name = - (export_type.resolved_type_name |> ResolvedName.to_string) - ^ "$ReScript" - in - let type_params_string = - EmitText.generics_string ~type_vars:export_type.type_vars - in - let expected_string = - EmitType.type_to_string ~config ~type_name_is_interface expected - in - Emitters.export_early ~emitters - ("type " ^ alias_name ^ type_params_string ^ " = " - ^ expected_string ^ ";")) - Emitters.initial - in - (* Determine if we need to emit the helper alias(es) for $GenTypeImport. *) - let needs_gentype_import_helper, needs_gentype_import_strict_helper = - export_from_type_declarations - |> List.fold_left - (fun (need_std, need_strict) - ({CodeItem.export_type} : CodeItem.export_from_type_declaration) - -> - match export_type.type_ with - | Ident {name; _} when String.equal name GentypeImportHelper.name -> - (true, need_strict) - | Ident {name; _} - when String.equal name GentypeImportHelper.strict_name -> - (need_std, true) - | _ -> (need_std, need_strict)) - (false, false) - in + let emitters = Emitters.initial in let type_name_is_interface ~env = type_name_is_interface ~export_type_map ~export_type_map_from_other_files:env.export_type_map_from_other_files @@ -778,17 +728,6 @@ let emit_translation_as_string ~(config : Config.t) ~file_name module_items_emitter |> ExportModule.emit_all_module_items ~config ~emitters ~file_name in - (* If we used the $GenTypeImport wrapper(s), emit helper alias(es) early. *) - let emitters = - let emitters = - if needs_gentype_import_helper then - Emitters.export_early ~emitters GentypeImportHelper.alias - else emitters - in - if needs_gentype_import_strict_helper then - Emitters.export_early ~emitters GentypeImportHelper.strict_alias - else emitters - in emitters |> emit_requires ~imported_value_or_component:false ~early:true ~config ~requires:final_env.requires_early diff --git a/compiler/gentype/GentypeImportHelper.ml b/compiler/gentype/GentypeImportHelper.ml deleted file mode 100644 index 951740b55d..0000000000 --- a/compiler/gentype/GentypeImportHelper.ml +++ /dev/null @@ -1,21 +0,0 @@ -open GenTypeCommon - -let name = "$GenTypeImport" - -let alias = "type $GenTypeImport = T;" - -let strict_name = "$GenTypeImportStrict" - -let strict_alias = - "type $GenTypeImportStrict = Expected;" - -let rec should_inline_expected (t : type_) : bool = - match t with - | Ident {builtin = true; name; _} -> ( - match name with - | "number" | "string" | "boolean" -> true - | _ -> false) - | Tuple inner -> inner |> List.for_all should_inline_expected - | Array (t, _) -> should_inline_expected t - | Promise t -> should_inline_expected t - | _ -> false diff --git a/compiler/gentype/TranslateTypeDeclarations.ml b/compiler/gentype/TranslateTypeDeclarations.ml index 9d314aa233..e8b0e3952f 100644 --- a/compiler/gentype/TranslateTypeDeclarations.ml +++ b/compiler/gentype/TranslateTypeDeclarations.ml @@ -59,7 +59,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver | false -> None (* one means don't know *) in - let import_string_opt, name_as, import_exact_opt, remote_export_name_opt = + let import_string_opt, name_as, _import_exact_opt, remote_export_name_opt = type_attributes |> Annotation.get_attribute_import_renaming in let unboxed_annotation = @@ -83,7 +83,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver |> Translation.translate_dependencies ~config ~output_file_relative ~resolver in - {CodeItem.import_types; export_from_type_declaration; expected_type = None} + {CodeItem.import_types; export_from_type_declaration} in let translate_label_declarations ?(inline = false) label_declarations = let field_translations = @@ -159,132 +159,21 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver let base_import = {CodeItem.type_name; as_type_name = Some as_type_name; import_path} in - (* If the declaration has a manifest type, capture its full translation - so we can both build the Expected type and import its dependencies. *) - let expected_translation_opt = - match declaration_kind with - | GeneralDeclaration (Some core_type) -> - Some - (core_type |> TranslateCoreType.translate_core_type ~config ~type_env) - | GeneralDeclarationFromTypes (Some type_expr) -> - Some - (type_expr - |> TranslateTypeExprFromTypes.translate_type_expr_from_types ~config - ~type_env) - | RecordDeclarationFromTypes label_declarations -> - Some (label_declarations |> translate_label_declarations) - | VariantDeclarationFromTypes constructor_declarations -> - let variants = - constructor_declarations - |> List.map (fun constructor_declaration -> - let constructor_args = constructor_declaration.Types.cd_args in - let attributes = constructor_declaration.cd_attributes in - let name = constructor_declaration.cd_id |> Ident.name in - let args_translation = - match constructor_args with - | Cstr_tuple type_exprs -> - type_exprs - |> TranslateTypeExprFromTypes - .translate_type_exprs_from_types ~config ~type_env - | Cstr_record label_declarations -> - [ - label_declarations - |> translate_label_declarations ~inline:true; - ] - in - let arg_types = - args_translation - |> List.map (fun {TranslateTypeExprFromTypes.type_} -> type_) - in - (name, attributes, arg_types)) - in - let variants_no_payload, variants_with_payload = - variants |> List.partition (fun (_, _, arg_types) -> arg_types = []) - in - let no_payloads = - variants_no_payload - |> List.map (fun (name, attributes, _argTypes) -> - (name, attributes) |> create_case ~poly:false) - in - let payloads = - variants_with_payload - |> List.map (fun (name, attributes, arg_types) -> - let type_ = - match arg_types with - | [type_] -> type_ - | _ -> Tuple arg_types - in - { - case = (name, attributes) |> create_case ~poly:false; - t = type_; - }) - in - let variant_typ = - create_variant ~inherits:[] ~no_payloads ~payloads ~polymorphic:false - ~tag:tag_annotation ~unboxed:unboxed_annotation - in - Some {TranslateTypeExprFromTypes.dependencies = []; type_ = variant_typ} - | _ -> None - in - - (* Import any referenced non-builtin identifiers from the same module as - the base imported type. This ensures shims work (e.g. mapping ReactEvent - types to a local shim module), matching previous behavior. *) - let extra_type_imports = - match expected_translation_opt with - | Some tr -> - GentypeTypeFold.fold - (fun acc (t : GenTypeCommon.type_) -> - match t with - | Ident {builtin = false; name; _} -> name :: acc - | _ -> acc) - [] tr.type_ - |> List.sort_uniq String.compare - |> List.filter (fun n -> n <> type_name) - |> List.map (fun n -> - {CodeItem.type_name = n; as_type_name = None; import_path}) - | None -> [] - in - let import_types = base_import :: extra_type_imports in + (* Only import the aliased TypeScript type; no wrappers or extra aliases. *) + let import_types = [base_import] in let export_from_type_declaration = (* Make the imported type usable from other modules by exporting it too. *) - let imported_ident = + let export_type_body = as_type_name |> ident ~type_args:(type_vars |> List.map (fun s -> TypeVar s)) in - let export_type_body = - match expected_translation_opt with - | Some tr -> ( - let expected_for_wrapper = - if GentypeImportHelper.should_inline_expected tr.type_ then tr.type_ - else - name_with_module_path ^ "$ReScript" - |> ident ~builtin:false - ~type_args:(type_vars |> List.map (fun s -> TypeVar s)) - in - match import_exact_opt with - | Some true -> - ident GentypeImportHelper.strict_name - ~type_args:[imported_ident; expected_for_wrapper] - | _ -> - ident GentypeImportHelper.name - ~type_args:[expected_for_wrapper; imported_ident]) - | None -> imported_ident - in typeName_ |> create_export_type_from_type_declaration ~doc_string ~annotation:GenType ~loc ~name_as:None ~opaque:(Some false) ~type_:export_type_body ~type_env ~type_vars in [ - { - CodeItem.import_types; - export_from_type_declaration; - expected_type = - (match expected_translation_opt with - | Some tr -> Some tr.type_ - | None -> None); - }; + {CodeItem.import_types; export_from_type_declaration}; ] | (GeneralDeclarationFromTypes None | GeneralDeclaration None), None -> { @@ -293,7 +182,6 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver type_name |> create_export_type_from_type_declaration ~doc_string ~annotation ~loc ~name_as ~opaque:(Some true) ~type_:unknown ~type_env ~type_vars; - expected_type = None; } |> return_type_declaration | GeneralDeclarationFromTypes (Some type_expr), None -> @@ -349,7 +237,6 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver type_name |> create_export_type_from_type_declaration ~doc_string ~annotation ~loc ~name_as ~opaque ~type_ ~type_env ~type_vars; - expected_type = None; } |> return_type_declaration | VariantDeclarationFromTypes constructor_declarations, None -> @@ -428,7 +315,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver |> List.map (fun (_, _, _, import_types) -> import_types) |> List.concat in - {CodeItem.export_from_type_declaration; import_types; expected_type = None} + {CodeItem.export_from_type_declaration; import_types} |> return_type_declaration | NoDeclaration, None -> [] diff --git a/compiler/gentype/Translation.ml b/compiler/gentype/Translation.ml index 1db30006cc..31b5f6fc13 100644 --- a/compiler/gentype/Translation.ml +++ b/compiler/gentype/Translation.ml @@ -208,7 +208,7 @@ let add_type_declarations_from_module_equations ~type_env (translation : t) = .annotation; }; import_types = []; - expected_type = None; + })) |> List.concat in diff --git a/tests/gentype_tests/genimport-single/Makefile b/tests/gentype_tests/genimport-single/Makefile index 52d6c034b8..809b7c1556 100644 --- a/tests/gentype_tests/genimport-single/Makefile +++ b/tests/gentype_tests/genimport-single/Makefile @@ -3,32 +3,21 @@ SHELL = /bin/bash test: yarn workspaces focus @tests/gentype-genimport-single yarn build - # Helper exists once in single generated file - grep -Fq 'type $$GenTypeImport = T;' src/GenTypeImportExpectedErrors.gen.tsx - # Wrapper lines for each case present - grep -Fq 'export type numberT = $$GenTypeImport,' src/GenTypeImportExpectedErrors.gen.tsx - # nested arrays may render as Array; accept either style - grep -Fq 'export type nestedArrayT = $$GenTypeImport' src/GenTypeImportExpectedErrors.gen.tsx - # Positive wrapper present too - grep -Fq 'export type stringT = $$GenTypeImport ts-errors.txt 2>&1 || true - # Expect exactly 5 TS2344 errors (the mismatches), and no others - test $$(grep -c 'error TS2344' ts-errors.txt) -eq 5 - grep -Fq "Type 'string' does not satisfy the constraint 'number'." ts-errors.txt - grep -Fq "Type 'string' does not satisfy the constraint '[number, string]'." ts-errors.txt - grep -Fq "Type 'string' does not satisfy the constraint 'number[]'." ts-errors.txt - grep -Fq "Type 'string' does not satisfy the constraint 'Promise'." ts-errors.txt - grep -Fq "Type 'string' does not satisfy the constraint 'number[][]'." ts-errors.txt - # Positive should not produce any error about constraint 'string' - if grep -Fq "constraint 'string'." ts-errors.txt; then \ - echo 'Unexpected error for positive string case' ; \ + if [ -s ts-errors.txt ]; then \ + echo 'Unexpected TypeScript errors:' ; \ + cat ts-errors.txt ; \ exit 1 ; \ else \ - echo 'All expected TS errors present; positive has no error' ; \ + echo 'TypeScript typecheck clean' ; \ fi clean: diff --git a/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx b/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx index ddd806fe2a..eee0354acd 100644 --- a/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx +++ b/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx @@ -3,16 +3,6 @@ /* eslint-disable */ /* tslint:disable */ -type groupRenderProps$ReScript = { - readonly isHovered: boolean; - readonly isFocusWithin: boolean; - readonly isFocusVisible: boolean; - readonly isDisabled: boolean; - readonly isInvalid: boolean -}; - -type $GenTypeImportStrict = Expected; - import type {GroupRenderProps as GroupRenderProps$TypeScript} from 'react-aria-components'; -export type groupRenderProps = $GenTypeImportStrict; +export type groupRenderProps = GroupRenderProps$TypeScript; diff --git a/tests/gentype_tests/genimport-single/src/AriaComponents.res b/tests/gentype_tests/genimport-single/src/AriaComponents.res index 308c0cf0c1..072cfbebb0 100644 --- a/tests/gentype_tests/genimport-single/src/AriaComponents.res +++ b/tests/gentype_tests/genimport-single/src/AriaComponents.res @@ -1,4 +1,4 @@ -@genType.import({importPath: ("react-aria-components", "GroupRenderProps"), exact: true}) +@genType.import(("react-aria-components", "GroupRenderProps")) type groupRenderProps = { isHovered: bool, isFocusWithin: bool, diff --git a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx index 1d30781eaa..84f68eb5ff 100644 --- a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx +++ b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx @@ -3,23 +3,21 @@ /* eslint-disable */ /* tslint:disable */ -type $GenTypeImport = T; - import * as GenTypeImportExpectedErrorsJS from './GenTypeImportExpectedErrors.res.js'; import type {Type as Type$TypeScript} from 'external-module'; -export type numberT = $GenTypeImport; +export type numberT = Type$TypeScript; -export type tupleT = $GenTypeImport<[number, string],Type$TypeScript>; +export type tupleT = Type$TypeScript; -export type arrayT = $GenTypeImport; +export type arrayT = Type$TypeScript; -export type promiseT = $GenTypeImport,Type$TypeScript>; +export type promiseT = Type$TypeScript; -export type nestedArrayT = $GenTypeImport,Type$TypeScript>; +export type nestedArrayT = Type$TypeScript; -export type stringT = $GenTypeImport; +export type stringT = Type$TypeScript; export const useNumber: (x:numberT) => numberT = GenTypeImportExpectedErrorsJS.useNumber as any; diff --git a/tests/gentype_tests/genimport-single/ts-errors.txt b/tests/gentype_tests/genimport-single/ts-errors.txt deleted file mode 100644 index 23eaf510c2..0000000000 --- a/tests/gentype_tests/genimport-single/ts-errors.txt +++ /dev/null @@ -1,5 +0,0 @@ -src/GenTypeImportExpectedErrors.gen.tsx(12,45): error TS2344: Type 'string' does not satisfy the constraint 'number'. -src/GenTypeImportExpectedErrors.gen.tsx(14,54): error TS2344: Type 'string' does not satisfy the constraint '[number, string]'. -src/GenTypeImportExpectedErrors.gen.tsx(16,46): error TS2344: Type 'string' does not satisfy the constraint 'number[]'. -src/GenTypeImportExpectedErrors.gen.tsx(18,55): error TS2344: Type 'string' does not satisfy the constraint 'Promise'. -src/GenTypeImportExpectedErrors.gen.tsx(20,59): error TS2344: Type 'string' does not satisfy the constraint 'number[][]'. diff --git a/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx b/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx index f7ddd32bc9..8552188b0e 100644 --- a/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx @@ -3,7 +3,7 @@ /* eslint-disable */ /* tslint:disable */ -import {make as makeNotChecked} from './hookExample'; +import {default as makeNotChecked} from './hookExample'; import {default as defaultNotChecked} from './hookExample'; diff --git a/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx b/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx index a34ffb0277..96acb5ab48 100644 --- a/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx @@ -21,8 +21,6 @@ import {polymorphic as polymorphicNotChecked} from './MyMath'; import {default as defaultNotChecked} from './MyMath'; -type AbsoluteValue_t$ReScript = { readonly getAbs: () => number }; - // In case of type error, check the type of 'round' in 'ImportJsValue.res' and './MyMath'. export const roundTypeChecked: (_1:number) => number = roundNotChecked as any; @@ -77,27 +75,27 @@ export const defaultTypeChecked: number = defaultNotChecked as any; // Export '$$default' early to allow circular import from the '.bs.js' file. export const $$default: unknown = defaultTypeChecked as number as any; -type $GenTypeImport = T; - const ImportJsValueJS = require('./ImportJsValue.res.js'); -import type {AbsoluteValue as AbsoluteValue$TypeScript} from './MyMath'; +import type {AbsoluteValue as $$AbsoluteValue_t} from './MyMath'; + +import type {num as $$myNum} from './MyMath'; -import type {num as num$TypeScript} from './MyMath'; +import type {num as $$num} from './MyMath'; -import type {numberOrString as numberOrString$TypeScript} from './MyMath'; +import type {numberOrString as $$numberOrString} from './MyMath'; -import type {polyType as polyType$TypeScript} from './MyMath'; +import type {polyType as $$polyType} from './MyMath'; -import type {stringFunction as stringFunction$TypeScript} from './MyMath'; +import type {stringFunction as $$stringFunction} from './MyMath'; export type point = { readonly x: number; readonly y: (undefined | number) }; -export type numberOrString = numberOrString$TypeScript; +export type numberOrString = $$numberOrString; -export type AbsoluteValue_t = $GenTypeImport; +export type AbsoluteValue_t = $$AbsoluteValue_t; -export type stringFunction = stringFunction$TypeScript; +export type stringFunction = $$stringFunction; export type color = "tomato" | "gray"; @@ -105,11 +103,11 @@ export type variant = { TAG: "I"; _0: number } | { TAG: "S"; _0: string }; -export type num = num$TypeScript; +export type num = $$num; -export type myNum = num$TypeScript; +export type myNum = $$myNum; -export type polyType = polyType$TypeScript; +export type polyType = $$polyType; export const roundedNumber: number = ImportJsValueJS.roundedNumber as any; diff --git a/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx b/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx index 074dacfc90..9e9e897357 100644 --- a/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx @@ -5,21 +5,15 @@ import {default as defaultNotChecked} from './MyInput'; -type inputFocusEvent$ReScript = ReactEvent_Focus_t; - // In case of type error, check the type of 'default' in 'MyInput.res' and './MyInput'. export const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> = defaultNotChecked as any; // Export '$$default' early to allow circular import from the '.bs.js' file. export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> as any; -type $GenTypeImport = T; - -import type {ReactEvent_Focus_t} from './shims/JsxEvent.shim'; - -import type {inputFocusEvent as inputFocusEvent$TypeScript} from './shims/JsxEvent.shim'; +import type {inputFocusEvent as $$inputFocusEvent} from './shims/JsxEvent.shim'; -export type inputFocusEvent = $GenTypeImport; +export type inputFocusEvent = $$inputFocusEvent; export type props = { readonly onFocus?: onFocus }; diff --git a/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx index 67e878c428..ee7c318a68 100644 --- a/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx @@ -7,10 +7,10 @@ import * as TestFirstClassModulesJS from './TestFirstClassModules.res.js'; import type {firstClassModule as FirstClassModulesInterface_firstClassModule} from './FirstClassModulesInterface.gen'; -import type {record as FirstClassModulesInterface_record} from './FirstClassModulesInterface.gen'; - import type {firstClassModule as FirstClassModules_firstClassModule} from './FirstClassModules.gen'; +import type {record as FirstClassModulesInterface_record} from './FirstClassModulesInterface.gen'; + export type firstClassModuleWithTypeEquations = { readonly out: (_1:o) => o; readonly Inner: { readonly inn: (_1:i) => i } }; export const convert: (x:FirstClassModules_firstClassModule) => FirstClassModules_firstClassModule = TestFirstClassModulesJS.convert as any; diff --git a/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx index 55e2ae7733..71698f9c87 100644 --- a/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx @@ -5,10 +5,10 @@ import * as TransitiveType1JS from './TransitiveType1.res.js'; -import type {t2 as TransitiveType2_t2} from './TransitiveType2.gen'; - import type {t2Alias as TransitiveType2_t2Alias} from './TransitiveType2.gen'; +import type {t2 as TransitiveType2_t2} from './TransitiveType2.gen'; + export const convert: (x:TransitiveType2_t2) => TransitiveType2_t2 = TransitiveType1JS.convert as any; export const convertAlias: (x:TransitiveType2_t2Alias) => TransitiveType2_t2Alias = TransitiveType1JS.convertAlias as any; diff --git a/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx index fe8050d86c..25d8ac0cb5 100644 --- a/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx @@ -5,10 +5,10 @@ import * as TypeParams3JS from './TypeParams3.res.js'; -import type {items as TypeParams2_items} from './TypeParams2.gen'; - import type {items2 as TypeParams2_items2} from './TypeParams2.gen'; +import type {items as TypeParams2_items} from './TypeParams2.gen'; + export const test: (x:TypeParams2_items) => TypeParams2_items = TypeParams3JS.test as any; export const test2: (x:TypeParams2_items2) => TypeParams2_items2 = TypeParams3JS.test2 as any; diff --git a/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx b/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx index 9217433483..cda2b782d6 100644 --- a/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx @@ -5,17 +5,17 @@ import * as TypesJS from './Types.res.js'; -import type {List_t as Belt_List_t} from '../../src/shims/Belt.shim'; - import type {Json_t as Js_Json_t} from '../../src/shims/Js.shim'; -import type {t as Location_t} from '../../src/location/location.gen'; +import type {List_t as Belt_List_t} from '../../src/shims/Belt.shim'; import type {M_t__ as TypeNameSanitize_M_t__} from '../../src/TypeNameSanitize.gen'; +import type {list} from '../../src/shims/RescriptPervasives.shim'; + import type {t_ as TypeNameSanitize_t_} from '../../src/TypeNameSanitize.gen'; -import type {list} from '../../src/shims/RescriptPervasives.shim'; +import type {t as Location_t} from '../../src/location/location.gen'; export type t = number; From 28a3093dc588a8264d04742846577c09e6cc51ee Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Tue, 9 Sep 2025 12:34:43 +0200 Subject: [PATCH 05/10] move to use dedicated @gentype.satisfies --- compiler/gentype/Annotation.ml | 25 ++++++++++- compiler/gentype/EmitJs.ml | 5 +++ compiler/gentype/EmitType.ml | 6 +++ compiler/gentype/GenTypeCommon.ml | 11 +++-- compiler/gentype/GenTypeConfig.ml | 3 ++ compiler/gentype/TranslateTypeDeclarations.ml | 44 ++++++++++++++++--- lib/rescript.lock | 2 +- .../src/AriaComponents.gen.tsx | 10 ++++- .../genimport-single/src/AriaComponents.res | 2 +- .../src/ImportHookDefault.gen.tsx | 2 +- .../src/ImportJsValue.gen.tsx | 24 +++++----- .../src/MyInput.gen.tsx | 4 +- .../src/TestFirstClassModules.gen.tsx | 4 +- .../src/TransitiveType1.gen.tsx | 4 +- .../src/TypeParams3.gen.tsx | 4 +- .../src/nested/Types.gen.tsx | 8 ++-- 16 files changed, 116 insertions(+), 42 deletions(-) diff --git a/compiler/gentype/Annotation.ml b/compiler/gentype/Annotation.ml index adb5cdd3ab..003f6be165 100644 --- a/compiler/gentype/Annotation.ml +++ b/compiler/gentype/Annotation.ml @@ -29,10 +29,14 @@ let tag_is_tag s = s = "tag" let tag_is_unboxed s = s = "unboxed" || s = "ocaml.unboxed" let tag_is_gentype_import s = s = "genType.import" || s = "gentype.import" let tag_is_gentype_opaque s = s = "genType.opaque" || s = "gentype.opaque" +let tag_is_gentype_satisfies s = s = "genType.satisfies" || s = "gentype.satisfies" let tag_is_one_of_the_gentype_annotations s = - tag_is_gentype s || tag_is_gentype_as s || tag_is_gentype_import s + tag_is_gentype s + || tag_is_gentype_as s + || tag_is_gentype_import s || tag_is_gentype_opaque s + || tag_is_gentype_satisfies s let tag_is_gentype_ignore_interface s = s = "genType.ignoreInterface" || s = "gentype.ignoreInterface" @@ -169,6 +173,25 @@ let get_attribute_import_renaming attributes = (Some import_string, gentype_as_renaming, None, Some rename_string) | _ -> (None, gentype_as_renaming, None, None) +let get_attribute_satisfies attributes = + match attributes |> get_attribute_payload tag_is_gentype_satisfies with + | Some (_loc, TuplePayload payloads) -> ( + let strings = + payloads + |> List.fold_left + (fun acc p -> + match p with + | StringPayload s -> s :: acc + | _ -> acc) + [] + |> List.rev + in + match strings with + | [] -> None + | import_str :: path -> Some (import_str, path)) + | Some (_loc, StringPayload s) -> Some (s, []) + | _ -> None + let get_tag attributes = match attributes |> get_attribute_payload tag_is_tag with | Some (_, StringPayload s) -> Some s diff --git a/compiler/gentype/EmitJs.ml b/compiler/gentype/EmitJs.ml index 9b14490df0..86726770e4 100644 --- a/compiler/gentype/EmitJs.ml +++ b/compiler/gentype/EmitJs.ml @@ -680,6 +680,11 @@ let emit_translation_as_string ~(config : Config.t) ~file_name ~input_cmt_translate_type_declarations ~output_file_relative ~resolver ~type_name_is_interface in + let emitters = + match config.emit_satisfies_helper with + | true -> EmitType.emit_satisfies_helper ~emitters + | false -> emitters + in let env, emitters = export_from_type_declarations |> emit_export_from_type_declarations ~config ~emitters ~env diff --git a/compiler/gentype/EmitType.ml b/compiler/gentype/EmitType.ml index 54e5777b8b..130fc4122b 100644 --- a/compiler/gentype/EmitType.ml +++ b/compiler/gentype/EmitType.ml @@ -424,6 +424,12 @@ let require ~early = let emit_import_react ~emitters = "import * as React from 'react';" |> require ~early:true ~emitters +let emit_satisfies_helper ~emitters = + let alias = + "export type $RescriptTypeSatisfiesTypeScriptType = TypeScriptType;" + in + Emitters.export_early ~emitters alias + let emit_import_type_as ~emitters ~config ~type_name ~as_type_name ~type_name_is_interface ~import_path = let type_name = sanitize_type_name type_name in diff --git a/compiler/gentype/GenTypeCommon.ml b/compiler/gentype/GenTypeCommon.ml index 548289d922..ada6492fd3 100644 --- a/compiler/gentype/GenTypeCommon.ml +++ b/compiler/gentype/GenTypeCommon.ml @@ -180,10 +180,13 @@ let ident ?(builtin = true) ?(type_args = []) name = Ident {builtin; name; type_args} let sanitize_type_name name = - name - |> String.map (function - | '\'' -> '_' - | c -> c) + (* Preserve TS import("...") expressions intact. *) + if String.length name >= 7 && String.sub name 0 7 = "import(" then name + else + name + |> String.map (function + | '\'' -> '_' + | c -> c) let unknown = ident "unknown" let bigint_t = ident "BigInt" let boolean_t = ident "boolean" diff --git a/compiler/gentype/GenTypeConfig.ml b/compiler/gentype/GenTypeConfig.ml index 73925cc1d5..572a992658 100644 --- a/compiler/gentype/GenTypeConfig.ml +++ b/compiler/gentype/GenTypeConfig.ml @@ -17,6 +17,7 @@ type t = { bs_dependencies: string list; mutable emit_import_curry: bool; mutable emit_import_react: bool; + mutable emit_satisfies_helper: bool; mutable emit_type_prop_done: bool; mutable everything: bool; export_interfaces: bool; @@ -37,6 +38,7 @@ let default = bs_dependencies = []; emit_import_curry = false; emit_import_react = false; + emit_satisfies_helper = false; emit_type_prop_done = false; everything = false; export_interfaces = false; @@ -228,6 +230,7 @@ let read_config ~get_config_file ~namespace = suffix; emit_import_curry = false; emit_import_react = false; + emit_satisfies_helper = false; emit_type_prop_done = false; everything; export_interfaces; diff --git a/compiler/gentype/TranslateTypeDeclarations.ml b/compiler/gentype/TranslateTypeDeclarations.ml index e8b0e3952f..db308adc81 100644 --- a/compiler/gentype/TranslateTypeDeclarations.ml +++ b/compiler/gentype/TranslateTypeDeclarations.ml @@ -62,6 +62,30 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver let import_string_opt, name_as, _import_exact_opt, remote_export_name_opt = type_attributes |> Annotation.get_attribute_import_renaming in + let satisfies_opt = type_attributes |> Annotation.get_attribute_satisfies in + let annotation_for_export = + match satisfies_opt with + | Some _ -> Annotation.GenType + | None -> annotation + in + let apply_satisfies_wrapper type_ = + match satisfies_opt with + | None -> type_ + | Some (import_str, path) -> + (* Ensure we emit the helper once. *) + config.emit_satisfies_helper <- true; + let import_path = ImportPath.from_string_unsafe import_str in + let import_path_str = ImportPath.emit import_path in + let inline_import = + let base = "import(\"" ^ import_path_str ^ "\")" in + match path with + | [] -> base + | _ -> base ^ "." ^ String.concat "." path + in + let ts_type = ident ~builtin:true inline_import in + ident ~builtin:true ~type_args:[type_; ts_type] + "$RescriptTypeSatisfiesTypeScriptType" + in let unboxed_annotation = type_attributes |> Annotation.has_attribute Annotation.tag_is_unboxed in @@ -75,8 +99,11 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver (translation : TranslateTypeExprFromTypes.translation) = let export_from_type_declaration = type_name - |> create_export_type_from_type_declaration ~annotation ~loc ~name_as - ~opaque ~type_:translation.type_ ~type_env ~doc_string ~type_vars + |> create_export_type_from_type_declaration ~annotation:annotation_for_export + ~loc ~name_as + ~opaque + ~type_:(apply_satisfies_wrapper translation.type_) + ~type_env ~doc_string ~type_vars in let import_types = translation.dependencies @@ -220,7 +247,8 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver ~polymorphic:true ~tag:None ~unboxed:false | _ -> translation.type_ in - {translation with type_} |> handle_general_declaration + {translation with type_ = apply_satisfies_wrapper type_} + |> handle_general_declaration |> return_type_declaration | RecordDeclarationFromTypes label_declarations, None -> let {TranslateTypeExprFromTypes.dependencies; type_} = @@ -235,8 +263,10 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver CodeItem.import_types; export_from_type_declaration = type_name - |> create_export_type_from_type_declaration ~doc_string ~annotation ~loc - ~name_as ~opaque ~type_ ~type_env ~type_vars; + |> create_export_type_from_type_declaration ~doc_string + ~annotation:annotation_for_export ~loc + ~name_as ~opaque ~type_:(apply_satisfies_wrapper type_) + ~type_env ~type_vars; } |> return_type_declaration | VariantDeclarationFromTypes constructor_declarations, None -> @@ -302,12 +332,12 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver loc; name_as; opaque; - type_ = variant_typ; + type_ = apply_satisfies_wrapper variant_typ; type_vars; resolved_type_name; doc_string; }; - annotation; + annotation = annotation_for_export; } in let import_types = diff --git a/lib/rescript.lock b/lib/rescript.lock index 2c9e597f0a..35aa8f07a8 100644 --- a/lib/rescript.lock +++ b/lib/rescript.lock @@ -1 +1 @@ -69167 \ No newline at end of file +45559 \ No newline at end of file diff --git a/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx b/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx index eee0354acd..3047f5755e 100644 --- a/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx +++ b/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx @@ -3,6 +3,12 @@ /* eslint-disable */ /* tslint:disable */ -import type {GroupRenderProps as GroupRenderProps$TypeScript} from 'react-aria-components'; +export type $RescriptTypeSatisfiesTypeScriptType = TypeScriptType; -export type groupRenderProps = GroupRenderProps$TypeScript; +export type groupRenderProps = $RescriptTypeSatisfiesTypeScriptType<{ + readonly isHovered: boolean; + readonly isFocusWithin: boolean; + readonly isFocusVisible: boolean; + readonly isDisabled: boolean; + readonly isInvalid: boolean +},import("react-aria-components").GroupRenderProps>; diff --git a/tests/gentype_tests/genimport-single/src/AriaComponents.res b/tests/gentype_tests/genimport-single/src/AriaComponents.res index 072cfbebb0..d11477fbd1 100644 --- a/tests/gentype_tests/genimport-single/src/AriaComponents.res +++ b/tests/gentype_tests/genimport-single/src/AriaComponents.res @@ -1,4 +1,4 @@ -@genType.import(("react-aria-components", "GroupRenderProps")) +@gentype.satisfies(("react-aria-components", "GroupRenderProps")) type groupRenderProps = { isHovered: bool, isFocusWithin: bool, diff --git a/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx b/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx index 8552188b0e..f7ddd32bc9 100644 --- a/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx @@ -3,7 +3,7 @@ /* eslint-disable */ /* tslint:disable */ -import {default as makeNotChecked} from './hookExample'; +import {make as makeNotChecked} from './hookExample'; import {default as defaultNotChecked} from './hookExample'; diff --git a/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx b/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx index 96acb5ab48..1b6a1e3d95 100644 --- a/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx @@ -77,25 +77,23 @@ export const $$default: unknown = defaultTypeChecked as number as any; const ImportJsValueJS = require('./ImportJsValue.res.js'); -import type {AbsoluteValue as $$AbsoluteValue_t} from './MyMath'; +import type {AbsoluteValue as AbsoluteValue$TypeScript} from './MyMath'; -import type {num as $$myNum} from './MyMath'; +import type {num as num$TypeScript} from './MyMath'; -import type {num as $$num} from './MyMath'; +import type {numberOrString as numberOrString$TypeScript} from './MyMath'; -import type {numberOrString as $$numberOrString} from './MyMath'; +import type {polyType as polyType$TypeScript} from './MyMath'; -import type {polyType as $$polyType} from './MyMath'; - -import type {stringFunction as $$stringFunction} from './MyMath'; +import type {stringFunction as stringFunction$TypeScript} from './MyMath'; export type point = { readonly x: number; readonly y: (undefined | number) }; -export type numberOrString = $$numberOrString; +export type numberOrString = numberOrString$TypeScript; -export type AbsoluteValue_t = $$AbsoluteValue_t; +export type AbsoluteValue_t = AbsoluteValue$TypeScript; -export type stringFunction = $$stringFunction; +export type stringFunction = stringFunction$TypeScript; export type color = "tomato" | "gray"; @@ -103,11 +101,11 @@ export type variant = { TAG: "I"; _0: number } | { TAG: "S"; _0: string }; -export type num = $$num; +export type num = num$TypeScript; -export type myNum = $$myNum; +export type myNum = num$TypeScript; -export type polyType = $$polyType; +export type polyType = polyType$TypeScript; export const roundedNumber: number = ImportJsValueJS.roundedNumber as any; diff --git a/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx b/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx index 9e9e897357..7b160c677e 100644 --- a/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx @@ -11,9 +11,9 @@ export const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:in // Export '$$default' early to allow circular import from the '.bs.js' file. export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> as any; -import type {inputFocusEvent as $$inputFocusEvent} from './shims/JsxEvent.shim'; +import type {inputFocusEvent as inputFocusEvent$TypeScript} from './shims/JsxEvent.shim'; -export type inputFocusEvent = $$inputFocusEvent; +export type inputFocusEvent = inputFocusEvent$TypeScript; export type props = { readonly onFocus?: onFocus }; diff --git a/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx index ee7c318a68..67e878c428 100644 --- a/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx @@ -7,10 +7,10 @@ import * as TestFirstClassModulesJS from './TestFirstClassModules.res.js'; import type {firstClassModule as FirstClassModulesInterface_firstClassModule} from './FirstClassModulesInterface.gen'; -import type {firstClassModule as FirstClassModules_firstClassModule} from './FirstClassModules.gen'; - import type {record as FirstClassModulesInterface_record} from './FirstClassModulesInterface.gen'; +import type {firstClassModule as FirstClassModules_firstClassModule} from './FirstClassModules.gen'; + export type firstClassModuleWithTypeEquations = { readonly out: (_1:o) => o; readonly Inner: { readonly inn: (_1:i) => i } }; export const convert: (x:FirstClassModules_firstClassModule) => FirstClassModules_firstClassModule = TestFirstClassModulesJS.convert as any; diff --git a/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx index 71698f9c87..55e2ae7733 100644 --- a/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx @@ -5,10 +5,10 @@ import * as TransitiveType1JS from './TransitiveType1.res.js'; -import type {t2Alias as TransitiveType2_t2Alias} from './TransitiveType2.gen'; - import type {t2 as TransitiveType2_t2} from './TransitiveType2.gen'; +import type {t2Alias as TransitiveType2_t2Alias} from './TransitiveType2.gen'; + export const convert: (x:TransitiveType2_t2) => TransitiveType2_t2 = TransitiveType1JS.convert as any; export const convertAlias: (x:TransitiveType2_t2Alias) => TransitiveType2_t2Alias = TransitiveType1JS.convertAlias as any; diff --git a/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx index 25d8ac0cb5..fe8050d86c 100644 --- a/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx @@ -5,10 +5,10 @@ import * as TypeParams3JS from './TypeParams3.res.js'; -import type {items2 as TypeParams2_items2} from './TypeParams2.gen'; - import type {items as TypeParams2_items} from './TypeParams2.gen'; +import type {items2 as TypeParams2_items2} from './TypeParams2.gen'; + export const test: (x:TypeParams2_items) => TypeParams2_items = TypeParams3JS.test as any; export const test2: (x:TypeParams2_items2) => TypeParams2_items2 = TypeParams3JS.test2 as any; diff --git a/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx b/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx index cda2b782d6..9217433483 100644 --- a/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx @@ -5,17 +5,17 @@ import * as TypesJS from './Types.res.js'; +import type {List_t as Belt_List_t} from '../../src/shims/Belt.shim'; + import type {Json_t as Js_Json_t} from '../../src/shims/Js.shim'; -import type {List_t as Belt_List_t} from '../../src/shims/Belt.shim'; +import type {t as Location_t} from '../../src/location/location.gen'; import type {M_t__ as TypeNameSanitize_M_t__} from '../../src/TypeNameSanitize.gen'; -import type {list} from '../../src/shims/RescriptPervasives.shim'; - import type {t_ as TypeNameSanitize_t_} from '../../src/TypeNameSanitize.gen'; -import type {t as Location_t} from '../../src/location/location.gen'; +import type {list} from '../../src/shims/RescriptPervasives.shim'; export type t = number; From 2b84d15bcb18947cb5e465c1e41a7470304627a5 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Tue, 9 Sep 2025 13:00:47 +0200 Subject: [PATCH 06/10] revert unrelated changes --- compiler/gentype/Annotation.ml | 38 +++----------- compiler/gentype/EmitJs.ml | 31 ++--------- compiler/gentype/EmitType.ml | 3 +- compiler/gentype/GentypeTypeFold.ml | 19 ------- compiler/gentype/TranslateTypeDeclarations.ml | 52 ++++++++----------- .../gentype/TranslateTypeExprFromTypes.ml | 42 --------------- compiler/gentype/Translation.ml | 6 +-- .../src/ImportHookDefault.gen.tsx | 2 +- .../src/ImportJsValue.gen.tsx | 24 +++++---- .../src/MyInput.gen.tsx | 4 +- .../src/TestFirstClassModules.gen.tsx | 4 +- .../src/TransitiveType1.gen.tsx | 4 +- .../src/TypeParams3.gen.tsx | 4 +- .../src/nested/Types.gen.tsx | 8 +-- 14 files changed, 62 insertions(+), 179 deletions(-) delete mode 100644 compiler/gentype/GentypeTypeFold.ml diff --git a/compiler/gentype/Annotation.ml b/compiler/gentype/Annotation.ml index 003f6be165..bd82aec149 100644 --- a/compiler/gentype/Annotation.ml +++ b/compiler/gentype/Annotation.ml @@ -7,7 +7,6 @@ type attribute_payload = | IntPayload of string | StringPayload of string | TuplePayload of attribute_payload list - | RecordPayload of (string * attribute_payload) list | UnrecognizedPayload type t = GenType | GenTypeOpaque | NoGenType @@ -29,14 +28,12 @@ let tag_is_tag s = s = "tag" let tag_is_unboxed s = s = "unboxed" || s = "ocaml.unboxed" let tag_is_gentype_import s = s = "genType.import" || s = "gentype.import" let tag_is_gentype_opaque s = s = "genType.opaque" || s = "gentype.opaque" -let tag_is_gentype_satisfies s = s = "genType.satisfies" || s = "gentype.satisfies" +let tag_is_gentype_satisfies s = + s = "genType.satisfies" || s = "gentype.satisfies" let tag_is_one_of_the_gentype_annotations s = - tag_is_gentype s - || tag_is_gentype_as s - || tag_is_gentype_import s - || tag_is_gentype_opaque s - || tag_is_gentype_satisfies s + tag_is_gentype s || tag_is_gentype_as s || tag_is_gentype_import s + || tag_is_gentype_opaque s || tag_is_gentype_satisfies s let tag_is_gentype_ignore_interface s = s = "genType.ignoreInterface" || s = "gentype.ignoreInterface" @@ -68,26 +65,6 @@ let rec get_attribute_payload check_text (attributes : Typedtree.attributes) = [] in Some (TuplePayload payloads) - | {pexp_desc = Pexp_record (fields, _)} -> - let items = - fields - |> List.fold_left - (fun acc - ({Parsetree.lid; x; _} : - Parsetree.expression Parsetree.record_element) -> - let key_opt = - match lid.Location.txt with - | Longident.Lident s -> Some s - | Longident.Ldot (_, s) -> Some s - | _ -> None - in - match (key_opt, from_expr x) with - | Some key, Some v -> (key, v) :: acc - | _ -> acc) - [] - |> List.rev - in - Some (RecordPayload items) | {pexp_desc = Pexp_ident {txt}} -> Some (IdentPayload txt) | _ -> None in @@ -163,15 +140,14 @@ let get_attribute_import_renaming attributes = let gentype_as_renaming = attributes |> get_gentype_as_renaming in match (attribute_import, gentype_as_renaming) with | Some (_, StringPayload import_string), _ -> - (Some import_string, gentype_as_renaming, None, None) + (Some import_string, gentype_as_renaming) | ( Some ( _, TuplePayload [StringPayload import_string; StringPayload rename_string] ), _ ) -> - (* Tuple form encodes (importPath, remoteExportName). Keep remote name separate. *) - (Some import_string, gentype_as_renaming, None, Some rename_string) - | _ -> (None, gentype_as_renaming, None, None) + (Some import_string, Some rename_string) + | _ -> (None, gentype_as_renaming) let get_attribute_satisfies attributes = match attributes |> get_attribute_payload tag_is_gentype_satisfies with diff --git a/compiler/gentype/EmitJs.ml b/compiler/gentype/EmitJs.ml index 86726770e4..d73e346393 100644 --- a/compiler/gentype/EmitJs.ml +++ b/compiler/gentype/EmitJs.ml @@ -601,7 +601,7 @@ let propagate_annotation_to_sub_types ~code_items in (new_type_map, !annotated_set) -let emit_translation_as_string ~(config : Config.t) ~file_name +let emit_translation_as_string ~config ~file_name ~input_cmt_translate_type_declarations ~output_file_relative ~resolver (translation : Translation.t) = let initial_env = @@ -649,33 +649,8 @@ let emit_translation_as_string ~(config : Config.t) ~file_name and env = initial_env in let env, emitters = (* imports from type declarations go first to build up type tables *) - let all_import_types = - import_types_from_type_declarations @ translation.import_types - |> List.sort_uniq Translation.import_type_compare - in - (* Prefer direct imports of an alias name over aliased imports from other modules. - Use a single pass map: keep first direct (no alias) for a given name, - otherwise keep the first seen. *) - let chosen_by_name = - List.fold_left - (fun acc (it : CodeItem.import_type) -> - let key = - match it.as_type_name with - | Some alias -> alias - | None -> it.type_name - in - match StringMap.find key acc with - | (prev : CodeItem.import_type) -> ( - match (prev.as_type_name, it.as_type_name) with - | None, Some _ -> acc (* keep direct over aliased *) - | _ -> acc) - | exception Not_found -> StringMap.add key it acc) - StringMap.empty all_import_types - in - let filtered_import_types = - chosen_by_name |> StringMap.to_seq |> Seq.map snd |> List.of_seq - in - filtered_import_types + import_types_from_type_declarations @ translation.import_types + |> List.sort_uniq Translation.import_type_compare |> emit_import_types ~config ~emitters ~env ~input_cmt_translate_type_declarations ~output_file_relative ~resolver ~type_name_is_interface diff --git a/compiler/gentype/EmitType.ml b/compiler/gentype/EmitType.ml index 130fc4122b..61f1ea50e1 100644 --- a/compiler/gentype/EmitType.ml +++ b/compiler/gentype/EmitType.ml @@ -426,7 +426,8 @@ let emit_import_react ~emitters = let emit_satisfies_helper ~emitters = let alias = - "export type $RescriptTypeSatisfiesTypeScriptType = TypeScriptType;" + "export type $RescriptTypeSatisfiesTypeScriptType = TypeScriptType;" in Emitters.export_early ~emitters alias diff --git a/compiler/gentype/GentypeTypeFold.ml b/compiler/gentype/GentypeTypeFold.ml deleted file mode 100644 index f4ce127c9f..0000000000 --- a/compiler/gentype/GentypeTypeFold.ml +++ /dev/null @@ -1,19 +0,0 @@ -open GenTypeCommon - -let rec fold f acc (t : type_) = - let acc = f acc t in - match t with - | Ident _ | TypeVar _ -> acc - | Array (t1, _) | Dict t1 | Option t1 | Null t1 | Nullable t1 | Promise t1 -> - fold f acc t1 - | Tuple ts -> List.fold_left (fold f) acc ts - | Object (_shape, fields) -> - List.fold_left (fun acc {type_} -> fold f acc type_) acc fields - | Function {arg_types; ret_type; _} -> - let acc = - List.fold_left (fun acc {a_type} -> fold f acc a_type) acc arg_types - in - fold f acc ret_type - | Variant {inherits; payloads; _} -> - let acc = List.fold_left (fold f) acc inherits in - List.fold_left (fun acc {t} -> fold f acc t) acc payloads diff --git a/compiler/gentype/TranslateTypeDeclarations.ml b/compiler/gentype/TranslateTypeDeclarations.ml index db308adc81..88c764328d 100644 --- a/compiler/gentype/TranslateTypeDeclarations.ml +++ b/compiler/gentype/TranslateTypeDeclarations.ml @@ -59,7 +59,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver | false -> None (* one means don't know *) in - let import_string_opt, name_as, _import_exact_opt, remote_export_name_opt = + let import_string_opt, name_as = type_attributes |> Annotation.get_attribute_import_renaming in let satisfies_opt = type_attributes |> Annotation.get_attribute_satisfies in @@ -99,9 +99,8 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver (translation : TranslateTypeExprFromTypes.translation) = let export_from_type_declaration = type_name - |> create_export_type_from_type_declaration ~annotation:annotation_for_export - ~loc ~name_as - ~opaque + |> create_export_type_from_type_declaration + ~annotation:annotation_for_export ~loc ~name_as ~opaque ~type_:(apply_satisfies_wrapper translation.type_) ~type_env ~doc_string ~type_vars in @@ -173,35 +172,31 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver let name_with_module_path = typeName_ |> TypeEnv.add_module_path ~type_env |> ResolvedName.to_string in - (* Use the remote export name (if provided) to build the import and alias. - Preserve casing from the TS source exactly. *) - let remote_type_name = - match remote_export_name_opt with - | Some s -> s - | None -> name_with_module_path + let type_name, as_type_name = + match name_as with + | Some as_string -> (as_string, "$$" ^ name_with_module_path) + | None -> (name_with_module_path, "$$" ^ name_with_module_path) in - let type_name = remote_type_name in - let as_type_name = remote_type_name ^ "$TypeScript" in - let import_path = import_string |> ImportPath.from_string_unsafe in - let base_import = - {CodeItem.type_name; as_type_name = Some as_type_name; import_path} + let import_types = + [ + { + CodeItem.type_name; + as_type_name = Some as_type_name; + import_path = import_string |> ImportPath.from_string_unsafe; + }; + ] in - (* Only import the aliased TypeScript type; no wrappers or extra aliases. *) - let import_types = [base_import] in let export_from_type_declaration = (* Make the imported type usable from other modules by exporting it too. *) - let export_type_body = - as_type_name - |> ident ~type_args:(type_vars |> List.map (fun s -> TypeVar s)) - in typeName_ |> create_export_type_from_type_declaration ~doc_string ~annotation:GenType ~loc ~name_as:None ~opaque:(Some false) - ~type_:export_type_body ~type_env ~type_vars + ~type_: + (as_type_name + |> ident ~type_args:(type_vars |> List.map (fun s -> TypeVar s))) + ~type_env ~type_vars in - [ - {CodeItem.import_types; export_from_type_declaration}; - ] + [{CodeItem.import_types; export_from_type_declaration}] | (GeneralDeclarationFromTypes None | GeneralDeclaration None), None -> { CodeItem.import_types = []; @@ -248,8 +243,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver | _ -> translation.type_ in {translation with type_ = apply_satisfies_wrapper type_} - |> handle_general_declaration - |> return_type_declaration + |> handle_general_declaration |> return_type_declaration | RecordDeclarationFromTypes label_declarations, None -> let {TranslateTypeExprFromTypes.dependencies; type_} = label_declarations |> translate_label_declarations @@ -264,8 +258,8 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver export_from_type_declaration = type_name |> create_export_type_from_type_declaration ~doc_string - ~annotation:annotation_for_export ~loc - ~name_as ~opaque ~type_:(apply_satisfies_wrapper type_) + ~annotation:annotation_for_export ~loc ~name_as ~opaque + ~type_:(apply_satisfies_wrapper type_) ~type_env ~type_vars; } |> return_type_declaration diff --git a/compiler/gentype/TranslateTypeExprFromTypes.ml b/compiler/gentype/TranslateTypeExprFromTypes.ml index 5e6024495a..b6cdb8faff 100644 --- a/compiler/gentype/TranslateTypeExprFromTypes.ml +++ b/compiler/gentype/TranslateTypeExprFromTypes.ml @@ -118,48 +118,6 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env = } | (["Js"; "Re"; "t"] | ["RegExp"; "t"] | ["Stdlib"; "RegExp"; "t"]), [] -> {dependencies = []; type_ = regexp_t} - | ["Stdlib"; "ArrayBuffer"; "t"], [] -> - {dependencies = []; type_ = ident "ArrayBuffer"} - | ["Stdlib"; "DataView"; "t"], [] -> - {dependencies = []; type_ = ident "DataView"} - | ["Stdlib"; "Int8Array"; "t"], [] -> - {dependencies = []; type_ = ident "Int8Array"} - | ["Stdlib"; "Uint8Array"; "t"], [] -> - {dependencies = []; type_ = ident "Uint8Array"} - | ["Stdlib"; "Uint8ClampedArray"; "t"], [] -> - {dependencies = []; type_ = ident "Uint8ClampedArray"} - | ["Stdlib"; "Int16Array"; "t"], [] -> - {dependencies = []; type_ = ident "Int16Array"} - | ["Stdlib"; "Uint16Array"; "t"], [] -> - {dependencies = []; type_ = ident "Uint16Array"} - | ["Stdlib"; "Int32Array"; "t"], [] -> - {dependencies = []; type_ = ident "Int32Array"} - | ["Stdlib"; "Uint32Array"; "t"], [] -> - {dependencies = []; type_ = ident "Uint32Array"} - | ["Stdlib"; "Float32Array"; "t"], [] -> - {dependencies = []; type_ = ident "Float32Array"} - | ["Stdlib"; "Float64Array"; "t"], [] -> - {dependencies = []; type_ = ident "Float64Array"} - | ["Stdlib"; "BigInt64Array"; "t"], [] -> - {dependencies = []; type_ = ident "BigInt64Array"} - | ["Stdlib"; "BigUint64Array"; "t"], [] -> - {dependencies = []; type_ = ident "BigUint64Array"} - | ["Stdlib"; "Symbol"; "t"], [] -> {dependencies = []; type_ = ident "symbol"} - | ["Stdlib"; "Intl"; intl_module; "t"], [] -> - {dependencies = []; type_ = ident ("Intl." ^ intl_module)} - | (["Stdlib"; "Error"; "t"] | ["Stdlib"; "JsError"; "t"]), [] -> - {dependencies = []; type_ = ident "Error"} - | ["Stdlib"; "Iterator"; "t"], [param_translation] -> - { - dependencies = param_translation.dependencies; - type_ = ident ~type_args:[param_translation.type_] "Iterator"; - } - | ["Stdlib"; "AsyncIterator"; "t"], [param_translation] -> - { - dependencies = param_translation.dependencies; - type_ = ident ~type_args:[param_translation.type_] "AsyncIterator"; - } - | ["Stdlib"; "Ordering"; "t"], [] -> {dependencies = []; type_ = number_t} | ["unit"], [] -> {dependencies = []; type_ = unit_t} | (["array"] | ["Js"; ("Array" | "Array2"); "t"]), [param_translation] -> {param_translation with type_ = Array (param_translation.type_, Mutable)} diff --git a/compiler/gentype/Translation.ml b/compiler/gentype/Translation.ml index 31b5f6fc13..c80b413350 100644 --- a/compiler/gentype/Translation.ml +++ b/compiler/gentype/Translation.ml @@ -138,10 +138,7 @@ let translate_primitive ~config ~output_file_relative ~resolver ~type_env value_description.val_desc |> TranslateCoreType.translate_core_type ~config ~type_env in - let ( attribute_import, - attribute_renaming, - _import_exact_opt, - _remote_export_name_opt ) = + let attribute_import, attribute_renaming = value_description.val_attributes |> Annotation.get_attribute_import_renaming in match (type_expr_translation.type_, attribute_import) with @@ -208,7 +205,6 @@ let add_type_declarations_from_module_equations ~type_env (translation : t) = .annotation; }; import_types = []; - })) |> List.concat in diff --git a/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx b/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx index f7ddd32bc9..8552188b0e 100644 --- a/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx @@ -3,7 +3,7 @@ /* eslint-disable */ /* tslint:disable */ -import {make as makeNotChecked} from './hookExample'; +import {default as makeNotChecked} from './hookExample'; import {default as defaultNotChecked} from './hookExample'; diff --git a/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx b/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx index 1b6a1e3d95..96acb5ab48 100644 --- a/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx @@ -77,23 +77,25 @@ export const $$default: unknown = defaultTypeChecked as number as any; const ImportJsValueJS = require('./ImportJsValue.res.js'); -import type {AbsoluteValue as AbsoluteValue$TypeScript} from './MyMath'; +import type {AbsoluteValue as $$AbsoluteValue_t} from './MyMath'; -import type {num as num$TypeScript} from './MyMath'; +import type {num as $$myNum} from './MyMath'; -import type {numberOrString as numberOrString$TypeScript} from './MyMath'; +import type {num as $$num} from './MyMath'; -import type {polyType as polyType$TypeScript} from './MyMath'; +import type {numberOrString as $$numberOrString} from './MyMath'; -import type {stringFunction as stringFunction$TypeScript} from './MyMath'; +import type {polyType as $$polyType} from './MyMath'; + +import type {stringFunction as $$stringFunction} from './MyMath'; export type point = { readonly x: number; readonly y: (undefined | number) }; -export type numberOrString = numberOrString$TypeScript; +export type numberOrString = $$numberOrString; -export type AbsoluteValue_t = AbsoluteValue$TypeScript; +export type AbsoluteValue_t = $$AbsoluteValue_t; -export type stringFunction = stringFunction$TypeScript; +export type stringFunction = $$stringFunction; export type color = "tomato" | "gray"; @@ -101,11 +103,11 @@ export type variant = { TAG: "I"; _0: number } | { TAG: "S"; _0: string }; -export type num = num$TypeScript; +export type num = $$num; -export type myNum = num$TypeScript; +export type myNum = $$myNum; -export type polyType = polyType$TypeScript; +export type polyType = $$polyType; export const roundedNumber: number = ImportJsValueJS.roundedNumber as any; diff --git a/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx b/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx index 7b160c677e..9e9e897357 100644 --- a/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/MyInput.gen.tsx @@ -11,9 +11,9 @@ export const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:in // Export '$$default' early to allow circular import from the '.bs.js' file. export const $$default: unknown = defaultTypeChecked as React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> as any; -import type {inputFocusEvent as inputFocusEvent$TypeScript} from './shims/JsxEvent.shim'; +import type {inputFocusEvent as $$inputFocusEvent} from './shims/JsxEvent.shim'; -export type inputFocusEvent = inputFocusEvent$TypeScript; +export type inputFocusEvent = $$inputFocusEvent; export type props = { readonly onFocus?: onFocus }; diff --git a/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx index 67e878c428..ee7c318a68 100644 --- a/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TestFirstClassModules.gen.tsx @@ -7,10 +7,10 @@ import * as TestFirstClassModulesJS from './TestFirstClassModules.res.js'; import type {firstClassModule as FirstClassModulesInterface_firstClassModule} from './FirstClassModulesInterface.gen'; -import type {record as FirstClassModulesInterface_record} from './FirstClassModulesInterface.gen'; - import type {firstClassModule as FirstClassModules_firstClassModule} from './FirstClassModules.gen'; +import type {record as FirstClassModulesInterface_record} from './FirstClassModulesInterface.gen'; + export type firstClassModuleWithTypeEquations = { readonly out: (_1:o) => o; readonly Inner: { readonly inn: (_1:i) => i } }; export const convert: (x:FirstClassModules_firstClassModule) => FirstClassModules_firstClassModule = TestFirstClassModulesJS.convert as any; diff --git a/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx index 55e2ae7733..71698f9c87 100644 --- a/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TransitiveType1.gen.tsx @@ -5,10 +5,10 @@ import * as TransitiveType1JS from './TransitiveType1.res.js'; -import type {t2 as TransitiveType2_t2} from './TransitiveType2.gen'; - import type {t2Alias as TransitiveType2_t2Alias} from './TransitiveType2.gen'; +import type {t2 as TransitiveType2_t2} from './TransitiveType2.gen'; + export const convert: (x:TransitiveType2_t2) => TransitiveType2_t2 = TransitiveType1JS.convert as any; export const convertAlias: (x:TransitiveType2_t2Alias) => TransitiveType2_t2Alias = TransitiveType1JS.convertAlias as any; diff --git a/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx b/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx index fe8050d86c..25d8ac0cb5 100644 --- a/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/TypeParams3.gen.tsx @@ -5,10 +5,10 @@ import * as TypeParams3JS from './TypeParams3.res.js'; -import type {items as TypeParams2_items} from './TypeParams2.gen'; - import type {items2 as TypeParams2_items2} from './TypeParams2.gen'; +import type {items as TypeParams2_items} from './TypeParams2.gen'; + export const test: (x:TypeParams2_items) => TypeParams2_items = TypeParams3JS.test as any; export const test2: (x:TypeParams2_items2) => TypeParams2_items2 = TypeParams3JS.test2 as any; diff --git a/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx b/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx index 9217433483..cda2b782d6 100644 --- a/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx +++ b/tests/gentype_tests/typescript-react-example/src/nested/Types.gen.tsx @@ -5,17 +5,17 @@ import * as TypesJS from './Types.res.js'; -import type {List_t as Belt_List_t} from '../../src/shims/Belt.shim'; - import type {Json_t as Js_Json_t} from '../../src/shims/Js.shim'; -import type {t as Location_t} from '../../src/location/location.gen'; +import type {List_t as Belt_List_t} from '../../src/shims/Belt.shim'; import type {M_t__ as TypeNameSanitize_M_t__} from '../../src/TypeNameSanitize.gen'; +import type {list} from '../../src/shims/RescriptPervasives.shim'; + import type {t_ as TypeNameSanitize_t_} from '../../src/TypeNameSanitize.gen'; -import type {list} from '../../src/shims/RescriptPervasives.shim'; +import type {t as Location_t} from '../../src/location/location.gen'; export type t = number; From cef82cfa89d116337f2979cf5d03208924916312 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Tue, 9 Sep 2025 14:14:59 +0200 Subject: [PATCH 07/10] refactor tests etc a bit --- compiler/gentype/EmitJs.ml | 3 +- compiler/gentype/EmitType.ml | 52 +++++++++++++----- compiler/gentype/TranslateTypeDeclarations.ml | 6 +-- .../gentype/TranslateTypeExprFromTypes.ml | 42 +++++++++++++++ tests/gentype_tests/genimport-single/Makefile | 21 ++------ .../src/AriaComponents.gen.tsx | 22 +++++--- .../src/GenTypeImportExpectedErrors.gen.tsx | 32 ----------- .../GenTypeSatisfiesExpectedErrors.gen.tsx | 53 +++++++++++++++++++ ...res => GenTypeSatisfiesExpectedErrors.res} | 24 ++++----- .../src/GenTypeSatisfiesExpectedErrors.res.js | 36 +++++++++++++ tests/gentype_tests/genimport-single/test.sh | 24 +++++++++ .../genimport-single/ts-errors.txt | 5 ++ 12 files changed, 232 insertions(+), 88 deletions(-) delete mode 100644 tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx create mode 100644 tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.gen.tsx rename tests/gentype_tests/genimport-single/src/{GenTypeImportExpectedErrors.res => GenTypeSatisfiesExpectedErrors.res} (63%) create mode 100644 tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.res.js create mode 100755 tests/gentype_tests/genimport-single/test.sh create mode 100644 tests/gentype_tests/genimport-single/ts-errors.txt diff --git a/compiler/gentype/EmitJs.ml b/compiler/gentype/EmitJs.ml index d73e346393..80409476f2 100644 --- a/compiler/gentype/EmitJs.ml +++ b/compiler/gentype/EmitJs.ml @@ -635,7 +635,6 @@ let emit_translation_as_string ~config ~file_name |> List.map (fun (type_declaration : CodeItem.type_declaration) -> type_declaration.export_from_type_declaration) in - let emitters = Emitters.initial in let type_name_is_interface ~env = type_name_is_interface ~export_type_map ~export_type_map_from_other_files:env.export_type_map_from_other_files @@ -644,7 +643,7 @@ let emit_translation_as_string ~config ~file_name try export_type_map |> StringMap.find s with Not_found -> env.export_type_map_from_other_files |> StringMap.find s in - let emitters = emitters + let emitters = Emitters.initial and module_items_emitter = ExportModule.create_module_items_emitter () and env = initial_env in let env, emitters = diff --git a/compiler/gentype/EmitType.ml b/compiler/gentype/EmitType.ml index 61f1ea50e1..bdc3751324 100644 --- a/compiler/gentype/EmitType.ml +++ b/compiler/gentype/EmitType.ml @@ -118,18 +118,40 @@ let rec render_type ~(config : Config.t) ?(indent = None) ~type_name_is_interface | Ident {builtin; name; type_args} -> let name = name |> sanitize_type_name in - (match - (not builtin) && config.export_interfaces - && name |> type_name_is_interface - with - | true -> name |> interface_name ~config - | false -> name) - ^ EmitText.generics_string - ~type_vars: - (type_args - |> List.map - (render_type ~config ~indent ~type_name_is_interface ~in_fun_type) - ) + let rendered_name = + match + (not builtin) && config.export_interfaces + && name |> type_name_is_interface + with + | true -> name |> interface_name ~config + | false -> name + in + if name = "$RescriptTypeSatisfiesTypeScriptType" then + match type_args with + | [t1; t2] -> + let render_arg t = + " " + ^ (t + |> render_type ~config ~indent:(Some " ") ~type_name_is_interface + ~in_fun_type) + in + rendered_name ^ "<\n" ^ render_arg t1 ^ ",\n" ^ render_arg t2 ^ "\n>" + | _ -> + rendered_name + ^ EmitText.generics_string + ~type_vars: + (type_args + |> List.map + (render_type ~config ~indent ~type_name_is_interface + ~in_fun_type)) + else + rendered_name + ^ EmitText.generics_string + ~type_vars: + (type_args + |> List.map + (render_type ~config ~indent ~type_name_is_interface + ~in_fun_type)) | Null type_ -> "(null | " ^ (type_ |> render_type ~config ~indent ~type_name_is_interface ~in_fun_type) @@ -426,8 +448,10 @@ let emit_import_react ~emitters = let emit_satisfies_helper ~emitters = let alias = - "export type $RescriptTypeSatisfiesTypeScriptType = TypeScriptType;" + "export type $RescriptTypeSatisfiesTypeScriptType<\n\ + RescriptType,\n\ + TypeScriptType extends RescriptType\n\ + > = TypeScriptType;" in Emitters.export_early ~emitters alias diff --git a/compiler/gentype/TranslateTypeDeclarations.ml b/compiler/gentype/TranslateTypeDeclarations.ml index 88c764328d..fa4bd923f3 100644 --- a/compiler/gentype/TranslateTypeDeclarations.ml +++ b/compiler/gentype/TranslateTypeDeclarations.ml @@ -101,8 +101,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver type_name |> create_export_type_from_type_declaration ~annotation:annotation_for_export ~loc ~name_as ~opaque - ~type_:(apply_satisfies_wrapper translation.type_) - ~type_env ~doc_string ~type_vars + ~type_:translation.type_ ~type_env ~doc_string ~type_vars in let import_types = translation.dependencies @@ -212,7 +211,8 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver |> TranslateTypeExprFromTypes.translate_type_expr_from_types ~config ~type_env in - translation |> handle_general_declaration |> return_type_declaration + {translation with type_ = apply_satisfies_wrapper translation.type_} + |> handle_general_declaration |> return_type_declaration | GeneralDeclaration (Some core_type), None -> let translation = core_type |> TranslateCoreType.translate_core_type ~config ~type_env diff --git a/compiler/gentype/TranslateTypeExprFromTypes.ml b/compiler/gentype/TranslateTypeExprFromTypes.ml index b6cdb8faff..5e6024495a 100644 --- a/compiler/gentype/TranslateTypeExprFromTypes.ml +++ b/compiler/gentype/TranslateTypeExprFromTypes.ml @@ -118,6 +118,48 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env = } | (["Js"; "Re"; "t"] | ["RegExp"; "t"] | ["Stdlib"; "RegExp"; "t"]), [] -> {dependencies = []; type_ = regexp_t} + | ["Stdlib"; "ArrayBuffer"; "t"], [] -> + {dependencies = []; type_ = ident "ArrayBuffer"} + | ["Stdlib"; "DataView"; "t"], [] -> + {dependencies = []; type_ = ident "DataView"} + | ["Stdlib"; "Int8Array"; "t"], [] -> + {dependencies = []; type_ = ident "Int8Array"} + | ["Stdlib"; "Uint8Array"; "t"], [] -> + {dependencies = []; type_ = ident "Uint8Array"} + | ["Stdlib"; "Uint8ClampedArray"; "t"], [] -> + {dependencies = []; type_ = ident "Uint8ClampedArray"} + | ["Stdlib"; "Int16Array"; "t"], [] -> + {dependencies = []; type_ = ident "Int16Array"} + | ["Stdlib"; "Uint16Array"; "t"], [] -> + {dependencies = []; type_ = ident "Uint16Array"} + | ["Stdlib"; "Int32Array"; "t"], [] -> + {dependencies = []; type_ = ident "Int32Array"} + | ["Stdlib"; "Uint32Array"; "t"], [] -> + {dependencies = []; type_ = ident "Uint32Array"} + | ["Stdlib"; "Float32Array"; "t"], [] -> + {dependencies = []; type_ = ident "Float32Array"} + | ["Stdlib"; "Float64Array"; "t"], [] -> + {dependencies = []; type_ = ident "Float64Array"} + | ["Stdlib"; "BigInt64Array"; "t"], [] -> + {dependencies = []; type_ = ident "BigInt64Array"} + | ["Stdlib"; "BigUint64Array"; "t"], [] -> + {dependencies = []; type_ = ident "BigUint64Array"} + | ["Stdlib"; "Symbol"; "t"], [] -> {dependencies = []; type_ = ident "symbol"} + | ["Stdlib"; "Intl"; intl_module; "t"], [] -> + {dependencies = []; type_ = ident ("Intl." ^ intl_module)} + | (["Stdlib"; "Error"; "t"] | ["Stdlib"; "JsError"; "t"]), [] -> + {dependencies = []; type_ = ident "Error"} + | ["Stdlib"; "Iterator"; "t"], [param_translation] -> + { + dependencies = param_translation.dependencies; + type_ = ident ~type_args:[param_translation.type_] "Iterator"; + } + | ["Stdlib"; "AsyncIterator"; "t"], [param_translation] -> + { + dependencies = param_translation.dependencies; + type_ = ident ~type_args:[param_translation.type_] "AsyncIterator"; + } + | ["Stdlib"; "Ordering"; "t"], [] -> {dependencies = []; type_ = number_t} | ["unit"], [] -> {dependencies = []; type_ = unit_t} | (["array"] | ["Js"; ("Array" | "Array2"); "t"]), [param_translation] -> {param_translation with type_ = Array (param_translation.type_, Mutable)} diff --git a/tests/gentype_tests/genimport-single/Makefile b/tests/gentype_tests/genimport-single/Makefile index 809b7c1556..e3ee844977 100644 --- a/tests/gentype_tests/genimport-single/Makefile +++ b/tests/gentype_tests/genimport-single/Makefile @@ -1,24 +1,11 @@ SHELL = /bin/bash -test: +build: yarn workspaces focus @tests/gentype-genimport-single yarn build - # Expect direct type aliasing to imported TS type - grep -Fq 'export type numberT = Type$$TypeScript;' src/GenTypeImportExpectedErrors.gen.tsx - grep -Fq 'export type tupleT = Type$$TypeScript;' src/GenTypeImportExpectedErrors.gen.tsx - grep -Fq 'export type arrayT = Type$$TypeScript;' src/GenTypeImportExpectedErrors.gen.tsx - grep -Fq 'export type promiseT = Type$$TypeScript;' src/GenTypeImportExpectedErrors.gen.tsx - grep -Fq 'export type nestedArrayT = Type$$TypeScript;' src/GenTypeImportExpectedErrors.gen.tsx - grep -Fq 'export type stringT = Type$$TypeScript;' src/GenTypeImportExpectedErrors.gen.tsx - # Now TypeScript typecheck and ensure no type errors are emitted - yarn typecheck > ts-errors.txt 2>&1 || true - if [ -s ts-errors.txt ]; then \ - echo 'Unexpected TypeScript errors:' ; \ - cat ts-errors.txt ; \ - exit 1 ; \ - else \ - echo 'TypeScript typecheck clean' ; \ - fi + +test: build + ./test.sh clean: yarn workspaces focus @tests/gentype-genimport-single diff --git a/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx b/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx index 3047f5755e..102bce7dcd 100644 --- a/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx +++ b/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx @@ -3,12 +3,18 @@ /* eslint-disable */ /* tslint:disable */ -export type $RescriptTypeSatisfiesTypeScriptType = TypeScriptType; +export type $RescriptTypeSatisfiesTypeScriptType< +RescriptType, +TypeScriptType extends RescriptType +> = TypeScriptType; -export type groupRenderProps = $RescriptTypeSatisfiesTypeScriptType<{ - readonly isHovered: boolean; - readonly isFocusWithin: boolean; - readonly isFocusVisible: boolean; - readonly isDisabled: boolean; - readonly isInvalid: boolean -},import("react-aria-components").GroupRenderProps>; +export type groupRenderProps = $RescriptTypeSatisfiesTypeScriptType< + { + readonly isHovered: boolean; + readonly isFocusWithin: boolean; + readonly isFocusVisible: boolean; + readonly isDisabled: boolean; + readonly isInvalid: boolean + }, + import("react-aria-components").GroupRenderProps +>; diff --git a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx b/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx deleted file mode 100644 index 84f68eb5ff..0000000000 --- a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.gen.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* TypeScript file generated from GenTypeImportExpectedErrors.res by genType. */ - -/* eslint-disable */ -/* tslint:disable */ - -import * as GenTypeImportExpectedErrorsJS from './GenTypeImportExpectedErrors.res.js'; - -import type {Type as Type$TypeScript} from 'external-module'; - -export type numberT = Type$TypeScript; - -export type tupleT = Type$TypeScript; - -export type arrayT = Type$TypeScript; - -export type promiseT = Type$TypeScript; - -export type nestedArrayT = Type$TypeScript; - -export type stringT = Type$TypeScript; - -export const useNumber: (x:numberT) => numberT = GenTypeImportExpectedErrorsJS.useNumber as any; - -export const useTuple: (x:tupleT) => tupleT = GenTypeImportExpectedErrorsJS.useTuple as any; - -export const useArray: (x:arrayT) => arrayT = GenTypeImportExpectedErrorsJS.useArray as any; - -export const usePromise: (x:promiseT) => promiseT = GenTypeImportExpectedErrorsJS.usePromise as any; - -export const useNestedArray: (x:nestedArrayT) => nestedArrayT = GenTypeImportExpectedErrorsJS.useNestedArray as any; - -export const useString: (x:stringT) => stringT = GenTypeImportExpectedErrorsJS.useString as any; diff --git a/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.gen.tsx b/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.gen.tsx new file mode 100644 index 0000000000..47022cb596 --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.gen.tsx @@ -0,0 +1,53 @@ +/* TypeScript file generated from GenTypeSatisfiesExpectedErrors.res by genType. */ + +/* eslint-disable */ +/* tslint:disable */ + +export type $RescriptTypeSatisfiesTypeScriptType< +RescriptType, +TypeScriptType extends RescriptType +> = TypeScriptType; + +import * as GenTypeSatisfiesExpectedErrorsJS from './GenTypeSatisfiesExpectedErrors.res.js'; + +export type numberT = $RescriptTypeSatisfiesTypeScriptType< + number, + import("external-module").Type +>; + +export type tupleT = $RescriptTypeSatisfiesTypeScriptType< + [number, string], + import("external-module").Type +>; + +export type arrayT = $RescriptTypeSatisfiesTypeScriptType< + number[], + import("external-module").Type +>; + +export type promiseT = $RescriptTypeSatisfiesTypeScriptType< + Promise, + import("external-module").Type +>; + +export type nestedArrayT = $RescriptTypeSatisfiesTypeScriptType< + Array, + import("external-module").Type +>; + +export type stringT = $RescriptTypeSatisfiesTypeScriptType< + string, + import("external-module").Type +>; + +export const useNumber: (x:numberT) => numberT = GenTypeSatisfiesExpectedErrorsJS.useNumber as any; + +export const useTuple: (x:tupleT) => tupleT = GenTypeSatisfiesExpectedErrorsJS.useTuple as any; + +export const useArray: (x:arrayT) => arrayT = GenTypeSatisfiesExpectedErrorsJS.useArray as any; + +export const usePromise: (x:promiseT) => promiseT = GenTypeSatisfiesExpectedErrorsJS.usePromise as any; + +export const useNestedArray: (x:nestedArrayT) => nestedArrayT = GenTypeSatisfiesExpectedErrorsJS.useNestedArray as any; + +export const useString: (x:stringT) => stringT = GenTypeSatisfiesExpectedErrorsJS.useString as any; diff --git a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res b/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.res similarity index 63% rename from tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res rename to tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.res index 6c44e0ab58..941313bb09 100644 --- a/tests/gentype_tests/genimport-single/src/GenTypeImportExpectedErrors.res +++ b/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.res @@ -1,39 +1,39 @@ /* This module intentionally contains cases that should cause TypeScript errors when the external imported Type mismatches the ReScript manifest type. */ -@genType.import(("external-module", "Type")) +@gentype.satisfies(("external-module", "Type")) type numberT = int -@genType +@gentype let useNumber = (x: numberT) => x -@genType.import(("external-module", "Type")) +@gentype.satisfies(("external-module", "Type")) type tupleT = (int, string) -@genType +@gentype let useTuple = (x: tupleT) => x -@genType.import(("external-module", "Type")) +@gentype.satisfies(("external-module", "Type")) type arrayT = array -@genType +@gentype let useArray = (x: arrayT) => x -@genType.import(("external-module", "Type")) +@gentype.satisfies(("external-module", "Type")) type promiseT = Js.Promise.t -@genType +@gentype let usePromise = (x: promiseT) => x -@genType.import(("external-module", "Type")) +@gentype.satisfies(("external-module", "Type")) type nestedArrayT = array> -@genType +@gentype let useNestedArray = (x: nestedArrayT) => x /* Positive case: string matches external Type=string */ -@genType.import(("external-module", "Type")) +@gentype.satisfies(("external-module", "Type")) type stringT = string -@genType +@gentype let useString = (x: stringT) => x diff --git a/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.res.js b/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.res.js new file mode 100644 index 0000000000..c7070e2965 --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.res.js @@ -0,0 +1,36 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function useNumber(x) { + return x; +} + +function useTuple(x) { + return x; +} + +function useArray(x) { + return x; +} + +function usePromise(x) { + return x; +} + +function useNestedArray(x) { + return x; +} + +function useString(x) { + return x; +} + +export { + useNumber, + useTuple, + useArray, + usePromise, + useNestedArray, + useString, +} +/* No side effect */ diff --git a/tests/gentype_tests/genimport-single/test.sh b/tests/gentype_tests/genimport-single/test.sh new file mode 100755 index 0000000000..8d178074ab --- /dev/null +++ b/tests/gentype_tests/genimport-single/test.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Run TypeScript typecheck and snapshot the expected errors +yarn typecheck > ts-errors.txt 2>&1 || true + +# CI uses LF; normalize Windows CRLF just in case +if [ "${RUNNER_OS:-}" == "Windows" ]; then + perl -pi -e 's/\r\n/\n/g' -- ts-errors.txt +fi + +warningYellow='\033[0;33m' +successGreen='\033[0;32m' +reset='\033[0m' + +diff=$(git ls-files --modified ts-errors.txt) +if [[ $diff = "" ]]; then + printf "${successGreen}✅ TypeScript errors match snapshot (ts-errors.txt).${reset}\n" +else + printf "${warningYellow}⚠️ Unexpected change in TypeScript error snapshot (ts-errors.txt).${reset}\n" + git --no-pager diff -- ts-errors.txt + exit 1 +fi + diff --git a/tests/gentype_tests/genimport-single/ts-errors.txt b/tests/gentype_tests/genimport-single/ts-errors.txt new file mode 100644 index 0000000000..febc208934 --- /dev/null +++ b/tests/gentype_tests/genimport-single/ts-errors.txt @@ -0,0 +1,5 @@ +src/GenTypeSatisfiesExpectedErrors.gen.tsx(15,3): error TS2344: Type 'string' does not satisfy the constraint 'number'. +src/GenTypeSatisfiesExpectedErrors.gen.tsx(20,3): error TS2344: Type 'string' does not satisfy the constraint '[number, string]'. +src/GenTypeSatisfiesExpectedErrors.gen.tsx(25,3): error TS2344: Type 'string' does not satisfy the constraint 'number[]'. +src/GenTypeSatisfiesExpectedErrors.gen.tsx(30,3): error TS2344: Type 'string' does not satisfy the constraint 'Promise'. +src/GenTypeSatisfiesExpectedErrors.gen.tsx(35,3): error TS2344: Type 'string' does not satisfy the constraint 'number[][]'. From fd1f7e429798d07b9d7d9c739ed4b78f612b994e Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Tue, 9 Sep 2025 14:23:25 +0200 Subject: [PATCH 08/10] remove irrelevant files --- lib/bs/build.ninja | 0 lib/rescript.lock | 1 - packages/playground/src/App.res.js | 2 -- 3 files changed, 3 deletions(-) delete mode 100644 lib/bs/build.ninja delete mode 100644 lib/rescript.lock delete mode 100644 packages/playground/src/App.res.js diff --git a/lib/bs/build.ninja b/lib/bs/build.ninja deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/rescript.lock b/lib/rescript.lock deleted file mode 100644 index 35aa8f07a8..0000000000 --- a/lib/rescript.lock +++ /dev/null @@ -1 +0,0 @@ -45559 \ No newline at end of file diff --git a/packages/playground/src/App.res.js b/packages/playground/src/App.res.js deleted file mode 100644 index d856702bfe..0000000000 --- a/packages/playground/src/App.res.js +++ /dev/null @@ -1,2 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ From b48c3450ecc44927cb372e0d5b9279fe3fe7631a Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Tue, 9 Sep 2025 14:44:45 +0200 Subject: [PATCH 09/10] refactor --- compiler/gentype/EmitJs.ml | 2 +- compiler/gentype/EmitType.ml | 42 +++++++------------ compiler/gentype/SatisfiesHelpers.ml | 20 +++++++++ compiler/gentype/TranslateTypeDeclarations.ml | 2 +- 4 files changed, 37 insertions(+), 29 deletions(-) create mode 100644 compiler/gentype/SatisfiesHelpers.ml diff --git a/compiler/gentype/EmitJs.ml b/compiler/gentype/EmitJs.ml index 80409476f2..91fdf2e4ab 100644 --- a/compiler/gentype/EmitJs.ml +++ b/compiler/gentype/EmitJs.ml @@ -656,7 +656,7 @@ let emit_translation_as_string ~config ~file_name in let emitters = match config.emit_satisfies_helper with - | true -> EmitType.emit_satisfies_helper ~emitters + | true -> SatisfiesHelpers.emit_helper_alias ~emitters | false -> emitters in let env, emitters = diff --git a/compiler/gentype/EmitType.ml b/compiler/gentype/EmitType.ml index bdc3751324..9835b38aad 100644 --- a/compiler/gentype/EmitType.ml +++ b/compiler/gentype/EmitType.ml @@ -126,24 +126,21 @@ let rec render_type ~(config : Config.t) ?(indent = None) | true -> name |> interface_name ~config | false -> name in - if name = "$RescriptTypeSatisfiesTypeScriptType" then - match type_args with - | [t1; t2] -> - let render_arg t = - " " - ^ (t - |> render_type ~config ~indent:(Some " ") ~type_name_is_interface - ~in_fun_type) - in - rendered_name ^ "<\n" ^ render_arg t1 ^ ",\n" ^ render_arg t2 ^ "\n>" - | _ -> - rendered_name - ^ EmitText.generics_string - ~type_vars: - (type_args - |> List.map - (render_type ~config ~indent ~type_name_is_interface - ~in_fun_type)) + if SatisfiesHelpers.is_helper_ident name then + let rendered_type_args_special = + type_args + |> List.map + (render_type ~config ~indent:(Some " ") ~type_name_is_interface + ~in_fun_type) + in + let rendered_type_args_default = + type_args + |> List.map + (render_type ~config ~indent ~type_name_is_interface ~in_fun_type) + in + SatisfiesHelpers.render_helper_ident ~rendered_name + ~rendered_type_args:rendered_type_args_special + ~rendered_type_args_default else rendered_name ^ EmitText.generics_string @@ -446,15 +443,6 @@ let require ~early = let emit_import_react ~emitters = "import * as React from 'react';" |> require ~early:true ~emitters -let emit_satisfies_helper ~emitters = - let alias = - "export type $RescriptTypeSatisfiesTypeScriptType<\n\ - RescriptType,\n\ - TypeScriptType extends RescriptType\n\ - > = TypeScriptType;" - in - Emitters.export_early ~emitters alias - let emit_import_type_as ~emitters ~config ~type_name ~as_type_name ~type_name_is_interface ~import_path = let type_name = sanitize_type_name type_name in diff --git a/compiler/gentype/SatisfiesHelpers.ml b/compiler/gentype/SatisfiesHelpers.ml new file mode 100644 index 0000000000..cf644517e9 --- /dev/null +++ b/compiler/gentype/SatisfiesHelpers.ml @@ -0,0 +1,20 @@ +let helper_type_name = "$RescriptTypeSatisfiesTypeScriptType" + +let is_helper_ident name = name = helper_type_name + +let render_helper_ident ~rendered_name ~rendered_type_args + ~rendered_type_args_default = + match rendered_type_args with + | [a1; a2] -> + let render_arg s = " " ^ s in + rendered_name ^ "<\n" ^ render_arg a1 ^ ",\n" ^ render_arg a2 ^ "\n>" + | _ -> rendered_name ^ EmitText.generics_string ~type_vars:rendered_type_args_default + +let emit_helper_alias ~emitters = + let alias = + "export type $RescriptTypeSatisfiesTypeScriptType<\n\ + RescriptType,\n\ + TypeScriptType extends RescriptType\n\ + > = TypeScriptType;" + in + Emitters.export_early ~emitters alias diff --git a/compiler/gentype/TranslateTypeDeclarations.ml b/compiler/gentype/TranslateTypeDeclarations.ml index fa4bd923f3..fc0ed55fdb 100644 --- a/compiler/gentype/TranslateTypeDeclarations.ml +++ b/compiler/gentype/TranslateTypeDeclarations.ml @@ -84,7 +84,7 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver in let ts_type = ident ~builtin:true inline_import in ident ~builtin:true ~type_args:[type_; ts_type] - "$RescriptTypeSatisfiesTypeScriptType" + SatisfiesHelpers.helper_type_name in let unboxed_annotation = type_attributes |> Annotation.has_attribute Annotation.tag_is_unboxed From bb23e3d146d9916be008ace2dfe221dd27adcb54 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Tue, 9 Sep 2025 20:22:20 +0200 Subject: [PATCH 10/10] rework a bit mor --- compiler/gentype/CodeItem.ml | 1 + compiler/gentype/EmitJs.ml | 107 +++++++++++++----- compiler/gentype/EmitType.ml | 74 ++++++++++++ compiler/gentype/SatisfiesHelpers.ml | 10 +- compiler/gentype/Translation.ml | 54 ++++++++- .../src/AriaComponents.gen.tsx | 32 +++++- .../genimport-single/src/AriaComponents.res | 16 +++ .../GenTypeSatisfiesExpectedErrors.gen.tsx | 5 +- .../src/UsingAriaComponents.gen.tsx | 12 ++ .../src/UsingAriaComponents.res | 2 + .../src/UsingAriaComponents.res.js | 10 ++ .../genimport-single/ts-errors.txt | 10 +- 12 files changed, 281 insertions(+), 52 deletions(-) create mode 100644 tests/gentype_tests/genimport-single/src/UsingAriaComponents.gen.tsx create mode 100644 tests/gentype_tests/genimport-single/src/UsingAriaComponents.res create mode 100644 tests/gentype_tests/genimport-single/src/UsingAriaComponents.res.js diff --git a/compiler/gentype/CodeItem.ml b/compiler/gentype/CodeItem.ml index 7913263c67..6c6d5df832 100644 --- a/compiler/gentype/CodeItem.ml +++ b/compiler/gentype/CodeItem.ml @@ -15,6 +15,7 @@ type import_value = { import_annotation: Annotation.import; type_: type_; value_name: string; + export_binding: bool; (* when false, only emit local satisfies check, no TS export *) } type export_value = { diff --git a/compiler/gentype/EmitJs.ml b/compiler/gentype/EmitJs.ml index 91fdf2e4ab..ef5b32d4b1 100644 --- a/compiler/gentype/EmitJs.ml +++ b/compiler/gentype/EmitJs.ml @@ -143,7 +143,8 @@ let emit_code_item ~config ~emitters ~module_items_emitter ~env ~file_name Log_.item "Code Item: %s\n" (code_item |> code_item_to_string ~config ~type_name_is_interface); match code_item with - | ImportValue {as_path; import_annotation; type_; value_name} -> + | ImportValue {as_path; import_annotation; type_; value_name; export_binding} + -> let import_path = import_annotation.import_path in let first_name_in_path, rest_of_path = match value_name = as_path with @@ -163,8 +164,15 @@ let emit_code_item ~config ~emitters ~module_items_emitter ~env ~file_name in (emitters, value_name_not_checked, env) in - let type_ = + (* Extract potential satisfies wrapper to drive custom emission. *) + let satisfies_rescript_type_opt = match type_ with + | Ident {builtin = _; name; type_args = [rescript_t; _]} + when SatisfiesHelpers.is_helper_ident name -> Some rescript_t + | _ -> None + in + let adjust_for_function_component t = + match t with | Function ({ arg_types = [{a_type = Object (closed_flag, fields); a_name}]; @@ -217,44 +225,81 @@ let emit_code_item ~config ~emitters ~module_items_emitter ~env ~file_name } in Function function_ - | _ -> type_) - | _ -> type_ + | _ -> t) + | _ -> t + in + let type_for_emit = adjust_for_function_component type_ in + let value_name_type_checked = + let base = value_name ^ "TypeChecked" in + match export_binding with + | false -> "_" ^ base + | true -> base in - let value_name_type_checked = value_name ^ "TypeChecked" in let emitters = - imported_as_name ^ rest_of_path - |> EmitType.emit_export_const ~config - ~comment: - ("In case of type error, check the type of '" ^ value_name - ^ "' in '" - ^ (file_name |> ModuleName.to_string) - ^ ".res'" ^ " and '" - ^ (import_path |> ImportPath.emit) - ^ "'.") - ~early:true ~emitters ~name:value_name_type_checked ~type_ - ~type_name_is_interface + match satisfies_rescript_type_opt with + | Some rescript_type -> + let rescript_type = adjust_for_function_component rescript_type in + let expr = imported_as_name ^ rest_of_path in + (* Non-exported const for the checked binding, emitted early for ordering. *) + let comment = + match export_binding with + | false -> "Check imported TypeScript value conforms to ReScript type" + | true -> "" + in + EmitType.emit_const_satisfies ~early:true ~emitters ~config + ~satisfies_type:rescript_type ~type_name_is_interface ~comment + value_name_type_checked expr + | None -> + imported_as_name ^ rest_of_path + |> EmitType.emit_export_const ~config + ~comment: + ("In case of type error, check the type of '" ^ value_name + ^ "' in '" + ^ (file_name |> ModuleName.to_string) + ^ ".res'" ^ " and '" + ^ (import_path |> ImportPath.emit) + ^ "'.") + ~early:true ~emitters ~name:value_name_type_checked ~type_:type_for_emit + ~type_name_is_interface in let value_name_not_default = match value_name = "default" with | true -> Runtime.default | false -> value_name in - let emitters = - value_name_type_checked - |> EmitType.emit_type_cast ~config ~type_ ~type_name_is_interface - |> EmitType.emit_export_const - ~comment: - ("Export '" ^ value_name_not_default - ^ "' early to allow circular import from the '.bs.js' file.") - ~config ~early:true ~emitters ~name:value_name_not_default - ~type_:unknown ~type_name_is_interface - in - let emitters = - match value_name = "default" with - | true -> EmitType.emit_export_default ~emitters value_name_not_default - | false -> emitters + let env, emitters = + match export_binding with + | false -> (env, emitters) + | true -> + let emitters = + match satisfies_rescript_type_opt with + | Some _ -> + (* For satisfies, we can assign the typed binding directly without casts. *) + EmitType.emit_export_const_assign_value ~early:true ~emitters ~config + ~name:value_name_not_default ~type_:type_for_emit + ~type_name_is_interface value_name_type_checked + ~comment: + ("Export '" ^ value_name_not_default + ^ "' early to allow circular import from the '.bs.js' file.") + | None -> + value_name_type_checked + |> EmitType.emit_type_cast ~config ~type_:type_for_emit + ~type_name_is_interface + |> EmitType.emit_export_const + ~comment: + ("Export '" ^ value_name_not_default + ^ "' early to allow circular import from the '.bs.js' file.") + ~config ~early:true ~emitters ~name:value_name_not_default + ~type_:unknown ~type_name_is_interface + in + let emitters = + match value_name = "default" with + | true -> EmitType.emit_export_default ~emitters value_name_not_default + | false -> emitters + in + ({env with imported_value_or_component = true}, emitters) in - ({env with imported_value_or_component = true}, emitters) + (env, emitters) | ExportValue {doc_string; module_access_path; original_name; resolved_name; type_} -> let resolved_name_str = ResolvedName.to_string resolved_name in diff --git a/compiler/gentype/EmitType.ml b/compiler/gentype/EmitType.ml index 9835b38aad..15f2770692 100644 --- a/compiler/gentype/EmitType.ml +++ b/compiler/gentype/EmitType.ml @@ -361,6 +361,57 @@ let emit_export_const ~early ?(comment = "") ~config | false -> Emitters.export) ~emitters +let emit_export_const_satisfies ~early ?(comment = "") ~config + ?(doc_string = DocString.empty) ~emitters ~name ~satisfies_type + ~type_name_is_interface expr = + let type_string = + satisfies_type |> type_to_string ~config ~type_name_is_interface + in + (match comment = "" with + | true -> comment + | false -> "// " ^ comment ^ "\n") + ^ DocString.render doc_string + ^ "export const " + ^ name + ^ " = " + ^ expr + ^ " satisfies " + ^ type_string + ^ ";" + |> (match early with + | true -> Emitters.export_early + | false -> Emitters.export) + ~emitters + +let emit_const_satisfies ~early ~emitters ~config ~satisfies_type + ~type_name_is_interface ?(comment = "") name expr = + let type_string = + satisfies_type |> type_to_string ~config ~type_name_is_interface + in + ((match comment = "" with + | true -> "" + | false -> "// " ^ comment ^ "\n") + ^ "const " ^ name ^ " = " ^ expr ^ " satisfies " ^ type_string ^ ";") + |> (match early with + | true -> Emitters.export_early + | false -> Emitters.export) + ~emitters + +let emit_export_const_assign ~early ?(comment = "") ~config + ?(doc_string = DocString.empty) ~emitters ~name ~type_ + ~type_name_is_interface expr = + let type_string = type_ |> type_to_string ~config ~type_name_is_interface in + (match comment = "" with + | true -> comment + | false -> "// " ^ comment ^ "\n") + ^ DocString.render doc_string + ^ "export const " ^ name ^ ": " ^ type_string ^ " = " ^ expr + ^ ";" ^ "\n" ^ "// value-satisfies" + |> (match early with + | true -> Emitters.export_early + | false -> Emitters.export) + ~emitters + let emit_export_default ~emitters name = "export default " ^ name ^ ";" |> Emitters.export ~emitters @@ -472,3 +523,26 @@ let emit_import_type_as ~emitters ~config ~type_name ~as_type_name let emit_type_cast ~config ~type_ ~type_name_is_interface s = s ^ " as " ^ (type_ |> type_to_string ~config ~type_name_is_interface) + +let rec type_to_string_for_value ~config ~type_name_is_interface type_ = + match type_ with + | Ident {builtin = _; name; type_args = res_t :: _} + when SatisfiesHelpers.is_helper_ident name -> + type_to_string_for_value ~config ~type_name_is_interface res_t + | _ -> type_to_string ~config ~type_name_is_interface type_ + +let emit_export_const_assign_value ~early ?(comment = "") ~config + ?(doc_string = DocString.empty) ~emitters ~name ~type_ + ~type_name_is_interface expr = + let type_string = + type_ |> type_to_string_for_value ~config ~type_name_is_interface + in + (match comment = "" with + | true -> comment + | false -> "// " ^ comment ^ "\n") + ^ DocString.render doc_string + ^ "export const " ^ name ^ ": " ^ type_string ^ " = " ^ expr ^ ";" + |> (match early with + | true -> Emitters.export_early + | false -> Emitters.export) + ~emitters diff --git a/compiler/gentype/SatisfiesHelpers.ml b/compiler/gentype/SatisfiesHelpers.ml index cf644517e9..71ff7a0e0a 100644 --- a/compiler/gentype/SatisfiesHelpers.ml +++ b/compiler/gentype/SatisfiesHelpers.ml @@ -8,13 +8,13 @@ let render_helper_ident ~rendered_name ~rendered_type_args | [a1; a2] -> let render_arg s = " " ^ s in rendered_name ^ "<\n" ^ render_arg a1 ^ ",\n" ^ render_arg a2 ^ "\n>" - | _ -> rendered_name ^ EmitText.generics_string ~type_vars:rendered_type_args_default + | _ -> + rendered_name + ^ EmitText.generics_string ~type_vars:rendered_type_args_default let emit_helper_alias ~emitters = let alias = - "export type $RescriptTypeSatisfiesTypeScriptType<\n\ - RescriptType,\n\ - TypeScriptType extends RescriptType\n\ - > = TypeScriptType;" + "export type $RescriptTypeSatisfiesTypeScriptType = TypeScriptType;" in Emitters.export_early ~emitters alias diff --git a/compiler/gentype/Translation.ml b/compiler/gentype/Translation.ml index c80b413350..efb67b7eea 100644 --- a/compiler/gentype/Translation.ml +++ b/compiler/gentype/Translation.ml @@ -141,16 +141,63 @@ let translate_primitive ~config ~output_file_relative ~resolver ~type_env let attribute_import, attribute_renaming = value_description.val_attributes |> Annotation.get_attribute_import_renaming in - match (type_expr_translation.type_, attribute_import) with + let satisfies_attr = + value_description.val_attributes |> Annotation.get_attribute_satisfies + in + (* Determine whether to export the imported value on the TS surface. *) + let has_plain_gentype = + Annotation.has_attribute Annotation.tag_is_gentype + value_description.val_attributes + in + let has_gentype_import = + Annotation.has_attribute Annotation.tag_is_gentype_import + value_description.val_attributes + in + let export_binding = has_plain_gentype || has_gentype_import in + (* Optionally wrap the type with the `satisfies` helper when present. *) + let type_with_satisfies type_ = + match + value_description.val_attributes |> Annotation.get_attribute_satisfies + with + | None -> type_ + | Some (import_str, path) -> + let import_path = ImportPath.from_string_unsafe import_str in + let import_path_str = ImportPath.emit import_path in + (* For values, reference the TS value type via `typeof import('...').x` *) + let inline_import = + let base = "typeof import(\"" ^ import_path_str ^ "\")" in + match path with + | [] -> base + | _ -> base ^ "." ^ String.concat "." path + in + let ts_type = ident ~builtin:true inline_import in + ident ~builtin:true ~type_args:[type_; ts_type] + SatisfiesHelpers.helper_type_name + in + let effective_import_string = + match (attribute_import, satisfies_attr) with + | Some import_string, _ -> Some import_string + | None, Some (import_string, _) -> Some import_string + | None, None -> None + in + match (type_expr_translation.type_, effective_import_string) with | _, Some import_string -> let as_path = match attribute_renaming with | Some as_path -> as_path - | None -> value_name + | None -> ( + match satisfies_attr with + | Some (_import_str, path) -> ( + match List.rev path with + | last :: _ -> last + | [] -> value_name) + | None -> value_name) in let type_vars = type_expr_translation.type_ |> TypeVars.free in let type_ = - type_expr_translation.type_ |> abstract_the_type_parameters ~type_vars + type_expr_translation.type_ + |> abstract_the_type_parameters ~type_vars + |> type_with_satisfies in { import_types = @@ -164,6 +211,7 @@ let translate_primitive ~config ~output_file_relative ~resolver ~type_env import_annotation = import_string |> Annotation.import_from_string; type_; value_name; + export_binding; }; ]; type_declarations = []; diff --git a/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx b/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx index 102bce7dcd..83fb37f1e8 100644 --- a/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx +++ b/tests/gentype_tests/genimport-single/src/AriaComponents.gen.tsx @@ -3,10 +3,12 @@ /* eslint-disable */ /* tslint:disable */ -export type $RescriptTypeSatisfiesTypeScriptType< -RescriptType, -TypeScriptType extends RescriptType -> = TypeScriptType; +import {useTableOptions as useTableOptionsNotChecked} from 'react-aria-components'; + +export type $RescriptTypeSatisfiesTypeScriptType = TypeScriptType; + +// Check imported TypeScript value conforms to ReScript type +const _useTableOptionsTypeChecked = useTableOptionsNotChecked satisfies () => tableOptionsContextValue; export type groupRenderProps = $RescriptTypeSatisfiesTypeScriptType< { @@ -18,3 +20,25 @@ export type groupRenderProps = $RescriptTypeSatisfiesTypeScriptType< }, import("react-aria-components").GroupRenderProps >; + +export type selectionBehavior = $RescriptTypeSatisfiesTypeScriptType< + + "toggle" + | "replace", + import("react-stately").SelectionBehavior +>; + +export type selectionMode = $RescriptTypeSatisfiesTypeScriptType< + + "none" + | "single" + | "multiple", + import("react-stately").SelectionMode +>; + +export type tableOptionsContextValue = { + readonly selectionMode: selectionMode; + readonly selectionBehavior: (null | selectionBehavior); + readonly disallowEmptySelection: boolean; + readonly allowsDragging: boolean +}; diff --git a/tests/gentype_tests/genimport-single/src/AriaComponents.res b/tests/gentype_tests/genimport-single/src/AriaComponents.res index d11477fbd1..2921316f47 100644 --- a/tests/gentype_tests/genimport-single/src/AriaComponents.res +++ b/tests/gentype_tests/genimport-single/src/AriaComponents.res @@ -6,3 +6,19 @@ type groupRenderProps = { isDisabled: bool, isInvalid: bool, } + +@gentype.satisfies(("react-stately", "SelectionBehavior")) +type selectionBehavior = | @as("toggle") Toggle | @as("replace") Replace + +@gentype.satisfies(("react-stately", "SelectionMode")) +type selectionMode = | @as("none") None | @as("single") Single | @as("multiple") Multiple + +type tableOptionsContextValue = { + selectionMode: selectionMode, + selectionBehavior: Null.t, + disallowEmptySelection: bool, + allowsDragging: bool, +} + +@gentype.satisfies(("react-aria-components", "useTableOptions")) @module("react-aria-components") +external useTableOptions: unit => tableOptionsContextValue = "useTableOptions" diff --git a/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.gen.tsx b/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.gen.tsx index 47022cb596..940fed634f 100644 --- a/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.gen.tsx +++ b/tests/gentype_tests/genimport-single/src/GenTypeSatisfiesExpectedErrors.gen.tsx @@ -3,10 +3,7 @@ /* eslint-disable */ /* tslint:disable */ -export type $RescriptTypeSatisfiesTypeScriptType< -RescriptType, -TypeScriptType extends RescriptType -> = TypeScriptType; +export type $RescriptTypeSatisfiesTypeScriptType = TypeScriptType; import * as GenTypeSatisfiesExpectedErrorsJS from './GenTypeSatisfiesExpectedErrors.res.js'; diff --git a/tests/gentype_tests/genimport-single/src/UsingAriaComponents.gen.tsx b/tests/gentype_tests/genimport-single/src/UsingAriaComponents.gen.tsx new file mode 100644 index 0000000000..3ffaa8e7ef --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/UsingAriaComponents.gen.tsx @@ -0,0 +1,12 @@ +/* TypeScript file generated from UsingAriaComponents.res by genType. */ + +/* eslint-disable */ +/* tslint:disable */ + +export type $RescriptTypeSatisfiesTypeScriptType = TypeScriptType; + +import * as UsingAriaComponentsJS from './UsingAriaComponents.res.js'; + +import type {selectionMode as AriaComponents_selectionMode} from './AriaComponents.gen'; + +export const x: AriaComponents_selectionMode = UsingAriaComponentsJS.x as any; diff --git a/tests/gentype_tests/genimport-single/src/UsingAriaComponents.res b/tests/gentype_tests/genimport-single/src/UsingAriaComponents.res new file mode 100644 index 0000000000..2df7b44321 --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/UsingAriaComponents.res @@ -0,0 +1,2 @@ +@gentype +let x = AriaComponents.useTableOptions().selectionMode diff --git a/tests/gentype_tests/genimport-single/src/UsingAriaComponents.res.js b/tests/gentype_tests/genimport-single/src/UsingAriaComponents.res.js new file mode 100644 index 0000000000..22bb399e53 --- /dev/null +++ b/tests/gentype_tests/genimport-single/src/UsingAriaComponents.res.js @@ -0,0 +1,10 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as ReactAriaComponents from "react-aria-components"; + +let x = ReactAriaComponents.useTableOptions().selectionMode; + +export { + x, +} +/* x Not a pure module */ diff --git a/tests/gentype_tests/genimport-single/ts-errors.txt b/tests/gentype_tests/genimport-single/ts-errors.txt index febc208934..03e592d531 100644 --- a/tests/gentype_tests/genimport-single/ts-errors.txt +++ b/tests/gentype_tests/genimport-single/ts-errors.txt @@ -1,5 +1,5 @@ -src/GenTypeSatisfiesExpectedErrors.gen.tsx(15,3): error TS2344: Type 'string' does not satisfy the constraint 'number'. -src/GenTypeSatisfiesExpectedErrors.gen.tsx(20,3): error TS2344: Type 'string' does not satisfy the constraint '[number, string]'. -src/GenTypeSatisfiesExpectedErrors.gen.tsx(25,3): error TS2344: Type 'string' does not satisfy the constraint 'number[]'. -src/GenTypeSatisfiesExpectedErrors.gen.tsx(30,3): error TS2344: Type 'string' does not satisfy the constraint 'Promise'. -src/GenTypeSatisfiesExpectedErrors.gen.tsx(35,3): error TS2344: Type 'string' does not satisfy the constraint 'number[][]'. +src/GenTypeSatisfiesExpectedErrors.gen.tsx(12,3): error TS2344: Type 'string' does not satisfy the constraint 'number'. +src/GenTypeSatisfiesExpectedErrors.gen.tsx(17,3): error TS2344: Type 'string' does not satisfy the constraint '[number, string]'. +src/GenTypeSatisfiesExpectedErrors.gen.tsx(22,3): error TS2344: Type 'string' does not satisfy the constraint 'number[]'. +src/GenTypeSatisfiesExpectedErrors.gen.tsx(27,3): error TS2344: Type 'string' does not satisfy the constraint 'Promise'. +src/GenTypeSatisfiesExpectedErrors.gen.tsx(32,3): error TS2344: Type 'string' does not satisfy the constraint 'number[][]'.