-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Struct.keys as a typed alternative to Object.keys (#3282)
- Loading branch information
1 parent
63cfa0a
commit 1282502
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
Implement Struct.keys as a typed alternative to Object.keys | ||
|
||
```ts | ||
import { Struct } from "effect" | ||
|
||
const symbol: unique symbol = Symbol() | ||
|
||
const value = { | ||
a: 1, | ||
b: 2, | ||
[symbol]: 3 | ||
} | ||
|
||
const keys: Array<"a" | "b"> = Struct.keys(value) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters