Skip to content

Commit 6a59ec2

Browse files
committed
safer type signatures {..} as 'a returns 'a
1 parent 6375876 commit 6a59ec2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Core__Object.res

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ See [Object.assign on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScri
7575
*/
7676
external assignMany: ({..}, array<{..}>) => {..} = "Object.assign"
7777

78-
@val external copy: (@as(json`{}`) _, {..}) => {..} = "Object.assign"
78+
@val external copy: (@as(json`{}`) _, {..} as 'a) => 'a = "Object.assign"
7979

8080
/**
8181
`get` gets the value of a property by name. Returns `None` if the property does not exist or has the value `undefined`. Otherwise returns `Some`, including if the value is `null`.
@@ -160,7 +160,7 @@ point->Object.set("x", 13) // succeeds
160160
```
161161
*/
162162
@val
163-
external seal: 'a => 'a = "Object.seal"
163+
external seal: ({..} as 'a) => 'a = "Object.seal"
164164

165165
/**
166166
`preventExtensions` prevents new properties from being added to the object. It modifies the object (rather than creating a copy) and returns it.
@@ -177,7 +177,7 @@ obj->Object.set("c", 3) // fails
177177
```
178178
*/
179179
@val
180-
external preventExtensions: 'a => 'a = "Object.preventExtensions"
180+
external preventExtensions: ({..} as 'a) => 'a = "Object.preventExtensions"
181181

182182
/**
183183
`freeze` freezes an object. Freezing an object makes existing properties non-writable and prevents extensions. Once an object is frozen, new properties cannot be be added, existing properties cannot be removed, and their values cannot be changed.
@@ -196,7 +196,7 @@ obj->Object.set("a", 3) // fails
196196
```
197197
*/
198198
@val
199-
external freeze: 'a => 'a = "Object.freeze"
199+
external freeze: ({..} as 'a) => 'a = "Object.freeze"
200200

201201
/**
202202
`isSealed` determines if an object is sealed. A sealed object has a fixed set of properties.

0 commit comments

Comments
 (0)