You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The changes are listed [here](https://github.com/rescript-lang/rescript-compiler/blob/master/Changes.md#83), this is a large release, and we will go through some highlighted changes.
23
+
24
+
25
+
26
+
## Lightweight FFI attributes without `bs.` prefix
27
+
28
+
In this release, we make it optional to have `bs.` prefix it or not, this will make the FFI less verbose,
29
+
30
+
For example, the old externals for `readFileAsUtf8Sync` used to be written like this
Will now be compiled properly under es6 format as below:
63
+
64
+
```js
65
+
import Hello from "hello";
66
+
var a = Hello("hello");
67
+
```
68
+
69
+
70
+
## Customized js file extension support
71
+
72
+
Now user can pick up their js file extension support per module format:
73
+
74
+
```json
75
+
"package-specs": [{
76
+
"module": "es6",
77
+
"suffix": ".mjs"
78
+
},{
79
+
"module": "commonjs",
80
+
"suffix": ".cjs"
81
+
}],
82
+
83
+
```
84
+
85
+
## More flexible filename support
86
+
87
+
To have better integration with other [JS infrastructures](https://github.com/rescript-lang/rescript-compiler/issues/4624), for example, Next.js/React Native, we allow file names like `404.res`, `Button.Andriod.res` so that it can just be picked up by those tools
88
+
89
+
90
+
91
+
## Better type based inference for pattern `let {a,b,c} = value`
92
+
93
+
Previously for such piece of code:
94
+
95
+
```ocaml
96
+
module N = struct
97
+
type t = {
98
+
x : int
99
+
}
100
+
end
101
+
102
+
let f (u : N.t) =
103
+
let {x } = u in x + 1 (* type error *)
104
+
```
105
+
106
+
You will get a type error
107
+
108
+
```
109
+
Error: Unbound record field x
110
+
```
111
+
112
+
However, since the compiler already knows the type of `u`, it is capable of looking up the label `x` properly,
113
+
in this release, we make such style work out of the box without the work around like adding a module prefix like `let {N.x} = ..`
114
+
115
+
## Build system enhancement
116
+
117
+
A lot of work is put in improving the build system, we will expand on this topic in the next post!
0 commit comments