- Drop support for "bs-platform".
- Flow: use explicit suppression codes.
- Fix issue with object key needing quotes in JS when it is not a valid JS id.
- TypeScript: type children of imported components as
React.ReactNode
instead ofJSX.Element
.
- Add basic support for inherited type definitions in polymorphic variants e.g.
type color = [red | blue]
. No support for conversion at the moment.
- Add support for
external-stdlib
inbsconfig.json
. - Fix issue with
exportInterfaces
and labeled arguments (see #561).
- Remove support for legacy components.
- Flow: use
SyntheticMouseEvent
type for onClick.
- Make ReactEvent.Mouse.t be a builtin type corresponding to
MouseEvent
. - When loading a type defined in another file, treat it as if it were annotated with @genType. So if it's needed for an export from the current file, the annotation is already automatically propagated.
- Use
import type
syntax for TypeScript.
- Remove workaround in Flow that turns components into functions when exported.
- Add support for different file extensions using the
suffix
configuration frombsconfig.json
. - Fix issue where
let x:t = ...
is treated differently in.res
syntax.
- Only support bs-platform
8.2.0
or newer. - Give a warning when attempting to export a GADT type (unless it's already an opaque export), and export it as an opaque type.
- When not specified in
gentypeconfig
, read themodule
type frompackage-specs
. - Translate object types directly, whether or not they are wrapped in
Js.t
, in preparation for a compiler upgrade. Preserve a couple of existing uses which still map to the empty object:type t1<'a> = Js.t<'a>
,type t2 = Js.t<Obj.t>
. - Use
import
instead ofrequire
in TS back-end, unless there are circular dependencies. In both TS and Flow, circular dependencies can be avoided by not exporting anything in a file that imports a value/component. - Support future npm package
rescript
version9.1.0
and above. - Add support for the upcoming numeric poly variants (see rescript-lang/syntax#340).
- Fix issue with non-recursive types inside modules when the type name is already in scope (See #492).
- Support
bs-platform
version9.0.1
(es6 library modules reverted to.js
extension)
- Add
:
before location in warnings, so the correct line is picked up by vscocde terminal. - Allow
'
in the name of an exported type without generating invalid JS code. - Support
bs-platform
version9.0.0
(es6 library modules now use.mjs
extension). - [experimental] Extend experimental option to specify the full extension of generated files (see #497).
- Fix type of references which should be a record type since the runtime representation switched to records.
- Internal (Support multiple arguments on the command line for -cmt-rm).
- Add support for flexible file names introduced in bs-platform 8.3 (see #477).
- Fix conversion for nested variants from bs-platform 8 onwards.
- Fix name of functions emitted when an inner signature is annotated (see #474).
- Add missing support for annotations in inner module signatures (e.g.
module M : { ... } = { ... }
). See #469.
- Fix issue where a conversion was not applied to optional arguments due to mistaken covariance.
- Add support for bs-platform 8.3: abbreviated annotations (e.g.
as
instead ofbs.as
).
- Functions
React.ref(-) => React.element
are not considered function components anymore. - Make
React.ref(-)
types open objects, to align with how they are modeled by Flow.
- Add support for
bs.int
andbs.as
to@genType.import
.
- Add support for
bs.string
andbs.as
to@genType.import
. - Fix issue where
@genType.import
was not supported in interface files.
- Fix issue with conversion checking where inner modules without conversion were not exported. See #414.
- Fix conversion for ordinary variants without payload (conversion tables were missing).
- Support
@genType.as
for polymorphic variants in bucklescript 8.2.
- Fix conversion of ordinary variants with >1 payloads, in bs >= 8.
- More support for polymorphic variants in Bucklescript 8.2: no special case for a single payload case, and no renaming via
@genType.as
.
- Add missing support for
React.ref
(previouslyReact.Ref.t
). - Add ahead-of-time support for the new runtime representatiion of polymorphic variants in the upcoming Bucklescript 8.2.
- Add support for
.res[i]
files from the new Bucklescript Syntax.
- Support for bucklescript 8.0.0 (some minor changes wrt bs 8 beta).
- Fix issue where
bs.as
in records e.g.[@bs.as "the-key"] theKey: string,
was not escaped in the generated type.
- Add forward support for bucklescript 8.
- Only emit inner module when its vaues require no conversion. See #416.
- Give a warning when a
@genType
annotations is used with payload. E.g. in[@genType "foo"]
the payload"foo"
is ignored.
- Remove DCE and termination analysis.
- Fix issue where genType would not run when the only annotation is in the interface of an inner module.
- Fix issue where an inner module with more values in the implementation than the interface would not generate types annotated in the interface.
- Fix issue of missing parens when emitting optional function type.
- In Flow back-end, don't emit config suppression warnings for genType files.
- Support new uncurry representation that will be available from Bucklescript version 7.3.0.
- [DCE] Work around the fact that the react.componentt ppx gives
make
a dummy location. - [DCE] Add option to toggle removing dead values with side effects.
- [DCE] Add whitelist mechanism for function calls with no side effects.
- [DCE] Add support for lazyLoad.
- [DCE] Classify dead values that have side effects.
- [DCE] Don't report dead values within the scope of other dead values.
- Add support for int64.
- When a
@genType
annotation appears in a.re
, but the.rei
also exists, give a warning on the command-line that the annotation will be ignored. - Dead Code Elimination improvements and bug fixes. Add support for adding annotations to both implementations and interfaces. Analyze recursive functions.
- Add support for let%private: nothing is exported even when a
@genType
annotation is added. - [dce] Add
@dead
annotations to both interface and implementation. - Add builtin support for
Js.Date.t
.
- Extensions of experimental dead code/type analysis. Better annotations for .ml files, bug fixes, report on
let _ = e
whene
has no side effects.
- Support new internal representation of
bs.meth
used in the forthcoming bucklescript 7.2.0. - Experimental global dead code/type analysis with CLI
-dce
and-dce-cmt
for bucklescript and native projects respectively. Environment variablesWhitelist=prefix
andBlacklist=prefix
can be used to filter which results are reported based on their paths. UseWrite=1
to write@dead
annotations directly in the source files.
- Emit doc commments
/** this is a doc comment */
in the TypeScript output. - Preserve the parameter names in function types emitted by the TypeScript back-end.
- Treat a function with a single argument of unit type as if it had no arguments.
Example:
/**
* Sign a message with a key.
*
* @param message - A message to be signed
* @param key - The key with which to sign the message
* @returns A signed message
*/
[@genType]
let signMessage = (. message, key) => message ++ string_of_int(key);
produces
/**
* Sign a message with a key.
*
* @param message - A message to be signed
* @param key - The key with which to sign the message
* @returns A signed message
*/
export const signMessage: (message:string, key:number) => string = DocstringsBS.signMessage;
- Fix issue where a shadowed declaration would be emitted instead of the shadowing one. See #354.
- Emit Flow inexact types e.g.
{name:string, ...}
, supported from Flow version 0.84 onwards. - Emit
eslint-disable
in Untyped back-end.
- Fix issues where
@genType.as
on a type definition would omit type parameters.
- With TypeScript back-end, emit import of React when function components are exported. See #342.
- Alias
Js.Array2.t
to array type. - Add support for
[@unboxed]
which will be introduced in the next buclescript version. See https://caml.inria.fr/pub/docs/manual-ocaml/manual035.html.
- Emit in comments the source file from which the .gen file was generated.
- Add support for type
result
andBelt.Result.t
.
- Fix issue when emitting optional variants.
Variants are emitted as
| x | y
, remove the leading|
. Also, Flow uses?t
, so add parens:? (foo | bar)
. - Add builtin support for Js.String2.t as string.
- Add support for
@bs.as
to rename record fields (from bukclescript 7.0.0). At that point, use of@genType.as
on record fields will be discouraged, as it incurs the extra cost of runtime conversion. But it will be kept for backwards compatibility for existing code.
-
Add support for bucklescript dependencies, specified in
bs-dependencies
. For example, if the dependencies are"bs-dependencies": ["somelibrary"]
andsomelibrary
containsCommon.re
, this looks up the types offoo
in the library:[@genType] let z = Common.foo;
Scoped packages of the form e.g.
@demo/somelibrary
are also supported. Note: the library must have been published with the.gen.ts
files created by genType. -
With bucklescript 7.x.y, apply conversion when a record field requires renaming.
- Fix issue with
[@genType.import "."]
and[@genType.import ".."]
where the conversion function would be called.
, which is not a valid name. See #296. - Fix type errors in generated code with TypeScript compilers version 3.7.0 and later.
When importing a type use a local alias:
import type {weekday as $$weekday}
to avoid TypeScript errors about redefining types. See #302. - Fix issue when importing a type with type variables (the variables were omitted).
- Prepare support for bucklescript 6.3.x where records will be compiled to objects.
- Add support for
[@bs.meth]
.
- Make React.Ref more permissive:
{contents: null | T}
. - Make
ReactDOMRe.domRef
map toReact.Ref
.
- This release is equivalent in functionality to
v2.41.0
, but targets bucklescript versions6.2.x
(i.e. based on OCaml `4.6).
- Fix missing import React in untyped back-end.
- Fix version detection for bucklescript 6.2.x (inner modules).
- Use React.ReactNode for children in TypeScript.
- Work around an issue in which bucklescript passes the file names to genType. See #256.
- Export inner modules as objects (when at least one value in the module is exported). See: #253.
-
Add new annotation
[@genType.ignoreInterface];
. When added at the top.rei
file, the annotations will be taken from the.re
file. Use case: expose implementation details to JS but not to Reason. -
Always wrap export components in
React.createElement
. This fixes an issue when exported components are not functions e.g, because they useforwardRef
.
- Add config option to represent modules as objects at runtime. For compatibility with the upcoming bucklescript version 5.2.0.
- In TypeScript export children of Reason type
element
as TS typeReact.ReactChild
. So the exported component can be used from TS with string and number literals.
- Export Props type when exporting a function component.
- Add support for exporting references as 1-tuples. There are some nuances when the argument type requires conversion: #237.
- Fix issue where two constants with the same name would be generated in CommonJS mode.
- Add support for
[@genType] [@genType.as "SomeName"]
to export renamed values. - Add more compact form
[@genType "SomeName"]
.
-
Support import of
[@react.component]
components whose props require conversion. The conversion is performed by wrapping the component with aReact.createElement
call, so it works whether the component is a function or a class.All the TypeScript components are now typed with
React.ComponentType<...>
. If existing code was using e.g. render props of typeReact.FC<...>
, direct function callsfoo(props)
should now be replaced with JSX calls<foo props=... />
.See #226.
-
Add configuration option
"fileHeader"
to specify additional text to be emitted in the file header.
- Fix issue where conversion functions are not be generated for types defined in other files when
"importPath": "node",
is set ingentypeconfig
.
- Add support for default import when the value is called
default
in the external.[@genType.import "./MyMath"] external default: int = "default";
[@genType.import "./MyMath"] external someRenamedName: int = "default";
- Support externals with different name: external foo: someType = "fooRenamed".
- TypeScript: represent all function components with type
React.FC<...>
. A function component is any value of typeprops => React.element
whereprops
has type object.
Free type variables in typeprops
are replaced byany
.
- TypeScript: support importing a functional component declared with type React.FC<...>.
- Fix issue where direct type declarations of uncurried types were not recognized. Inferred uncurried types or declarations inside other types were working already.
- With untyped back-end, don't add type parameters to generated functions.
- Don't generate conversion for callbacks of type unit => ..., as it's unnecessary from bucklescript 5. Before bucklescript version 5, passing a function with arity 0 from JS would give a runtime error, so a conversion was used to avoid this, adding runtime cost.
- Make core react types builtin instead of requiring a shim file.
- Fix issue with flow back-end when exporting a function component with polymorphic variables.
- Fix issue where exporting a function returning React.element was not considered a function component. (Was checking React.reactElement).
React.element
and ReasonReact.reactElement
represented as React$Node
/JSX.Element
(Flow/TS).
React.callback(t1,t2)
represented as t1 => t2
.
React.component(t)
represented as t => React.element
.
React.Context.t(t)
represented as React.Context<t>
.
React.Ref.t(t)
represented as React.Ref<t>
.
ReactDOMRe.Ref.currentDomRef
represented as any
.
- In TypeScript, support --noImplicitAny also for indexing objects. (I.e. without --suppressImplicitAnyIndexErrors).
- Add support for importing values which are default exports in commonjs.
- Give exact Flow type to empty objects.
- Add support for importing functions of polymorphic type.
- Fix: don't export the state type of components using the old record API.
- Fix: extend automatic @genType annotation to type arguments.
- Fix issue when inlining type parameters across different modules.
- Don't delete generated files in case of type errors.
- Apply object field mangling convention to named arguments in functions. This gives a unified treatment for renaming of object fields, functions, and function components.
- Preserve case when importing from a lower-case file name.
- In TypeScript output, disable eslint rule import/first (on by default in newer react-scripts).
- Generate explicit return type for the function that type checks an imported (record) component.
- Support import of function components.
- Fix issue where only shallow conversion was generated for nested records defined in another file.
- Opaque types are now generated only for type definitions annotated with [@genType.opaque]. Unknown types now are left unchanged, so type errors will indicate that shims need to be added.
- Show file name in react developer tools when importing function components.
- Fix parentheses in function components with Flow back-end.
- Make Flow type check function components.
- Add experimental support for prop types. Add
"propTypes": true
and"language": "untyped"
to the configuration.
- Add support for default export like in bucklescript: call the value "default".
- Hooks: generate names analogous to those from ppx for the React developer tools.
- Apply bucklescript's marshaling rules for Js object field names:
Remove trailing
__
if present. Otherwise remove leading_
when followed by an uppercase letter, or keyword.
- Add first-class support for Js.Promise.t, and conversion when required.
- Emit the variant conversion tables in a stable order to limit changes when the source is modified.
- Fix: enable conversion for types defined inside a module in another file.
- Fix conversion for types involving multiple type definitions in another file.
- Add support for module aliases such as module X = A.B. Extra type definitions are added so that all the aliases of @genType-annotated type declarations are also exported. In case of local aliases to types from other files, these are always inlined.
- Add support for bucklescript version 5 (AST for bs.module has changed).
- Support file names starting with lower case letter.
If using bucklescript >= 5.0.0:
- It is not necessary anymore to set up
BS_CMT_POST_PROCESS_CMD
. - The line
[@bs.module "./ThisFileName.gen"]
in value imports can be omitted, and will be added internally by bucklescript.
- Avoid underscore when emitting conversion function for wrapJsForReason.
- Support inner modules with shadowed values.
- Fix: support transitive reachability of type definitions of arbitrary length. Before this, only paths of level 2 were available to generate conversion functions. E.g. this was not supported: A uses a type defined in B which uses a type defined in C.
- Omit underscore as function name when emitting conversions.
- Import Curry early, so it's available if needed for an import conversion.
- Automatically export types referenced by an imported value.
- Import CreateBuckescriptBlock early, so it's available if needed for an import conversion.
- Fix missing cases (records and variants): Don't import referenced types with genType.opaque.
- In flow, annotate function parameters with type any, just as for TypeScript. This helps typing conversion functions with nested null checks.
- Fix issue where importing a type which has no definition from other files could reset the type enironment. Resetting the type environment causes failures depending on the order of type arguments in #158.
- Emit type parametes when generating polymorphic conversion functions.
- Support type definitions in first-class module types.
- Handle correctly first-class module types with nested modules inside.
- Add support for first-class module types with type equations.
- Add support for functions with first-class module types and type equations.
- Fix support for type parameters in type declarations with constraints.
- Fix: don't export types defined in shims as opaque.
- Add support for type Js.null (and Js.Null.t).
- Fix signature of ImmutableArray length and size.
- Fix: convert first-class module types when defined in other files.
- Allow misspelling "genType" as "gentype".
- Auto uncurry functions of type unit => ...
- Wrap functions exported to JS with Curry._n (arity n) unless the functions have uncurried type.
- Support exporting types containing type variables at toplevel withoug making them opaque.
- Support exporting types defined in modules with type constraints.
- Extend support of first class modules to type declarations.
- Treat GADT declarations like normal ADT declarations.
- Add support for translation of inferred object types (using ##) and open object type declarations.
- Add support for open object types.
- Add support for String.t and Js.String.t.
- Avoid generating an extra type in renamed imports.
- Add support for pairs in @genType.import to encode rename information. Instead of writing
[@genType.import "./js/MyBanner"]
[@genType.as "TopLevelClass.MiddleLevelElements.MyBannerInternal"]
This can be used instead:
[@genType.import ("./js/MyBanner", "TopLevelClass.MiddleLevelElements.MyBannerInternal")]
- Fix issue with namespace mode: conversion was not performed for types defined in other files, as the correct .cmt files was not found.
- Restore support for namespaces, and make commonjs-react-example a namespace example.
- Add support for genType.as for the type name, to record type declarations.
- Fix issue where conversion functions for types defined in other files would be missing if the first declararation in that other file is not annotated with @genType.
- Flow mode: add eslint-disable.
- Fix missing conversion of optional arguments of components.
- Fix issue where default function arguments of some type requiring conversion were not checked for undefined.
- Add missing support for @genType.opaque in variants.
- Indent function definitions and if-then-else's.
- Indent variant declarations.
- Spacing after/before brackets in object types.
- In TypeScript, use the preferred semicolon in object types.
- In commonjs, import components simply as a
require
without ".default".
- New unified support for polymorphic variants and ordinary variants. If possible (at most one case with payload of object type), use an unboxed representation. Otherwise use
{tag: label, value: ...}
. - This is a Breaking Change: ordinary variants used to be represented as opaque types with construction functions. Now, ordinary variants have the same representation as polymorphic variants.
- Add support for paths in
@genType.as
when importing components from JS. Also, simply support renaming.
- Fix missing import React when importing component in untyped back-end.
- Fix issue with access to the .bs.js file when exporting nested component.
- Fix: Emit enum conversion tables early, to avoid the case where they’re used before being defined.
- Add support for exporting uncurried function types.
- Hygiene: avoid variable capture for generated variable names (function arguments, return value, array items).
- Adapt bs-platform lib import path depending on the module kind specified in config.
- Add -clean command to delete all the generated files.
- Fix: translation of variant types should be the identity.
- Avoid accidental variable name capture when generating constructors functions for variants.
- TypeScript: avoid type errors when converting function types by giving arguments type
any
.
- Auto propagate annotations to and from variant type declarations (not just normal type declarations).
- Auto propagate annotations to types mentioned in exported values and components.
- Fix importing type via renaming. Need to export both the original and renamed type.
- Translate empty object types as
{}
. This avoids pulling it a shim forJs.t
. - Support renaming via
[@genType.as "name"]
when exporting types.
- Emit
import
instead ofrequire
with ES6 modules in Flow/Untyped back-end, except when import cycles are possible (Reason importing JS values/components). PR. - Add support for
@genType.as
when importing values from JS. This supports renaming, importing default values, and importing nested values via a path.
- Don’t import type dependencies for opaque types.
- Add
bsconfig.json
option "generatedFileExtension" to configure the extension used for generated files. - Change the extension of generated files to
.gen.tsx
(TS) and.gen.js
(Flow/Untyped). #90 - Remove (undocumented)
genType.importStrictLocal
and always allow imports from non-scrict Flow types.
- Export first-class modules as records. Also allows to call functors from JS.
- Sanitize name of JS variable when importing a value. (Replace "-" with "_").
- Fix renaming of named argument when importing function type.
- Make genType.importStrictLocal only affect the specific import, not the whole file.
- Fix issue where pulling in types from files in other directories was not working.
- Add support for annotation @genType.importStrictLocal to generate strict-local Flow files.
- Support importing types with type parameters.
- Prevent imported values from being used directly from JS.
- Remove deprecated CLI option
—setProjectRoot
. - Support
@genType.as "name"
to rename how labeled arguments in functions are exported. Works for function definitions and function types declarations. In parcticular, themake
function for components. In case of function definitions, the first argument can't be renamed because of a compiler bug. See this issue.
- Improved debug output and number of options, and made controllable from bsconfig.json.
- Fixed issue with import strings containig
.\directory
on Windows. - Extended support for signatures and module types.
- Module include is supported for Type Expansion.
- First-orer modules are supported for Type Expansion.
- Functor application supported for Type Expansion.
- Annotating a type means all the types mentioned in it are also considered annotated. (Implemented via Type Expansion).
- Add support for type expansion See this issue
- Clean up terminology used in README.md. Following the cleanup plan on import/export in #70.
- Implement principle 1: an imported type is also exported to other modules.
- Support tuple types.
- In Flow, keep opaque types also opaque internally, so export erros are caught early like in TS.
- Fix: Type names for types which are defined somewhere are not considered opaque.
- Fix: no conversion generated for opaque types.
- Generated code can be in a different order, because of refactoring how type declarations are processed.
- Support the case where the
make
function of an exported Reason component could be curried. - Support
ImmutableArray.t
type for convesion toReadonlyArray
in TS/Flow. - Add library for immutable arrays.
- Fix missing handling of
@genType.opaque
. - Allow importing types from within nested modules.
- Allow a combination of
@genType.import
and@genType.as
to specify an imported type. - Object and record fields are now mapped to readonly propeties, unless they're mutable.
- Support nested components. So it's possible to define several components in one file.
- Support for recursive types. If a recursive type requires a conversion, only a shallow one is performed, and a warning comment is emitted.
- Update README describing how genType works in both directions.
- Add support for Enum types.
- Add support for nested modules: translation of nested types and values, as well as cross references.
- Remove deprecated way of wrapping JS components.
- Use strict imports for wrapping JS values and components.
- Generate opaque types corresponding to an existing Flow/TS type.
- Move "gentypeconfig" inside bsconfig.json. Using a file gentypeconfig.json is deprecated.
- Remove support for deprecated @genFlow annotation, and genflowconfig.json file.
- Experimental feature: Typed wrappers for JS values.
- Add full support for wrapping JS component, and examples.
- Support type Js.nullable in addition to Js.Nullable.t.
- Fix import name compare which can lead to missing type imports with the same name from diffent files.
- Add missing conversion from float to number.
- Add initial shim for Js.Array.t.
- Js.Null_undefined.t and Js.null_undefined are the same as nullable.
- Array types are not opaque.
- Shims for Obj.
- New format form shims: {"fromModuleName": "toModuleName"}.
- Cleaner generated output, with some basic pretty-printing heuristics.
- Generate TS code compatible with --strictPropertyInitialization.
- Add configuration options to gentypeconfig.json for module, importPath, reasonReactPath, bsBlockPath.
- Print version information with -help and -version.
- Improve support for checking JS component used from Reason.
- Support for nullable types Js.Nullable.t.
- Avoid generation of type any: use mixed (Flow) or unknown (TS) instead.
- Add ReactEvent shims for TypeScript.
- Use type “void” instead of “typeof undefined”.
- Fix converter for options to JS in nested case.
- Simplify converter for optional record fields.
- Support nullable types whose argument requires conversion.
- Support for object types: Js.t(...).
- Treat optional(_) fields of object types as with records (no conversion JS <-> Reason).
- Stricter checks for FlowType.
- [FlowType] include @generated and @nolint in prelude.
- Support CommonJS export.
- Fix export function type: not opaque.
- Support nested modules in shim files.
- Rename the project to genType, the executable to gentype.native, the config to gentypeconfig.json, the log to .genTypeLog.
- Import type definitions from other files.
- Allow gentypeconfig.json in addition to genflowconfig.json.
- Add
@genType.as
/@genFlow.as
to specify the name of the field seen from JS. - Full support for polymorphic types (type instantiation works correctly to generate conversions).
- Support conversion of types with free type variables.
- Depecate -setProjectRoot CLI option. The project root is now found automatically and the option ignored.
- Add "export default ComponentName" for TypeScript.
- Fix: props are contravariant.
- Use @genType annotation (the @genFlow annotation is still supported for backward compatibility).
- Print log information to .genFlowLog in the project root insted of standard output.
- [Add support for interface files] (https://github.com/cristianoc/genFlow/issues/19).
- Support for polymorphic props.
- Support conversion for user-defined types.
- Fix converter issue with nested optionals.
- Add support for array types and conversions.
- Add support for record types and conversions.
- Build with bsb-native.
- The set up path has changed to:
export BS_CMT_POST_PROCESS_CMD="$PWD/../lib/bs/native/genflow.native --setProjectRoot $PWD"
Initial release.