-
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SchemaAST: fix
TemplateLiteral
model (#4076)
- Loading branch information
Showing
12 changed files
with
491 additions
and
215 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,25 @@ | ||
--- | ||
"effect": patch | ||
--- | ||
|
||
Schema: fix bug in `Schema.TemplateLiteralParser` resulting in a runtime error. | ||
|
||
Before | ||
|
||
```ts | ||
import { Schema } from "effect" | ||
|
||
const schema = Schema.TemplateLiteralParser("a", "b") | ||
// throws TypeError: Cannot read properties of undefined (reading 'replace') | ||
``` | ||
|
||
After | ||
|
||
```ts | ||
import { Schema } from "effect" | ||
|
||
const schema = Schema.TemplateLiteralParser("a", "b") | ||
|
||
console.log(Schema.decodeUnknownSync(schema)("ab")) | ||
// Output: [ 'a', 'b' ] | ||
``` |
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,7 @@ | ||
--- | ||
"effect": patch | ||
--- | ||
|
||
SchemaAST: fix `TemplateLiteral` model. | ||
|
||
Added `Literal` and `Union` as valid types. |
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
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
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
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
Oops, something went wrong.