Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Fix issue where let x:t = ... is treated differently in .res syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianoc committed Apr 14, 2021
1 parent b43ec9b commit 07786e9
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# master
- Add support for different file extensions using the `suffix` configuration from `bsconfig.json`.
- Fix issue where `let x:t = ...` is treated differently in `.res` syntax.

# 3.45.0
- Only support bs-platform `8.2.0` or newer.
Expand Down
13 changes: 13 additions & 0 deletions examples/flow-react-example/src/LetWithType.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions examples/flow-react-example/src/LetWithType.gen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @flow strict
* @generated from LetWithType.res
* @nolint
*/
/* eslint-disable */

// $FlowExpectedError: Reason checked type sufficiently
import * as LetWithTypeBS from './LetWithType.bs';

export opaque type style = mixed;

export const white: style = LetWithTypeBS.white;
16 changes: 16 additions & 0 deletions examples/flow-react-example/src/LetWithType.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

module Style = {
type rec t =
| WHITE
| LIGHT
| GRAY
| CUSTOM(string)
}

include Style

@genType.opaque
type rec style = t

@genType
let white: style = WHITE
2 changes: 1 addition & 1 deletion src/TranslateStructure.re
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ let translateValueBinding =
~outputFileRelative,
~resolver,
~typeEnv,
~typeExpr=vb_expr.exp_type,
~typeExpr=vb_pat.pat_type,
~addAnnotationsToFunction=
addAnnotationsToFunctionType(~config, vb_expr),
);
Expand Down

0 comments on commit 07786e9

Please sign in to comment.