Skip to content

Commit b226d85

Browse files
committed
In GenType only export types (not values) from module types.
1 parent adb55d0 commit b226d85

File tree

3 files changed

+33
-21
lines changed

3 files changed

+33
-21
lines changed

jscomp/gentype/TranslateSignature.ml

+11-1
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,18 @@ and translateModuleTypeDeclaration ~config ~outputFileRelative ~resolver
6161
match mtd_type.mty_desc with
6262
| Tmty_signature signature ->
6363
let name = mtd_id |> Ident.name in
64+
(* XXX only translate types *)
65+
let signature_without_values =
66+
{
67+
signature with
68+
sig_items =
69+
Ext_list.filter signature.sig_items (function
70+
| {Typedtree.sig_desc = Typedtree.Tsig_value _} -> false
71+
| _ -> true);
72+
}
73+
in
6474
let translation =
65-
signature
75+
signature_without_values
6676
|> translateSignature ~config ~outputFileRelative ~resolver
6777
~typeEnv:(typeEnv |> TypeEnv.newModuleType ~name ~signature)
6878
|> Translation.combine

jscomp/gentype_tests/typescript-react-example/package-lock.json

+22-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/gentype_tests/typescript-react-example/src/FirstClassModulesInterface.gen.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
/* eslint-disable */
44
/* tslint:disable */
55

6-
import * as FirstClassModulesInterfaceBS__Es6Import from './FirstClassModulesInterface.bs';
7-
const FirstClassModulesInterfaceBS: any = FirstClassModulesInterfaceBS__Es6Import;
8-
96
export type record = { readonly x: number; readonly y: string };
107

118
export type firstClassModule = { readonly x: number };
12-
13-
export const MT_x: number = FirstClassModulesInterfaceBS.MT.x;
14-
15-
export const MT: { x: number } = FirstClassModulesInterfaceBS.MT

0 commit comments

Comments
 (0)