Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
fix dtslint
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Dec 20, 2023
1 parent cdab6b9 commit 8310159
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
12 changes: 2 additions & 10 deletions dtslint/Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,10 +659,10 @@ pipe(S.number, S.filter((n): n is number & Brand.Brand<"MyNumber"> => n > 0))
// plain

// $ExpectType Schema<string, readonly number[]>
S.compose(S.split(S.string, ","), S.array(S.NumberFromString))
S.compose(S.split(","), S.array(S.NumberFromString))

// $ExpectType Schema<string, readonly number[]>
S.split(S.string, ",").pipe(S.compose(S.array(S.NumberFromString)))
S.split(",").pipe(S.compose(S.array(S.NumberFromString)))

// decoding

Expand Down Expand Up @@ -781,14 +781,6 @@ S.transformLiteral(0, "a")
// $ExpectType Schema<0 | 1, "a" | "b">
S.transformLiterals([0, "a"], [1, "b"])

// ---------------------------------------------
// split
// ---------------------------------------------

// should support subtypes of `string`
// $ExpectType Schema<`a${string}`, readonly string[]>
S.templateLiteral(S.literal("a"), S.string).pipe(S.split(":"))

// ---------------------------------------------
// Class
// ---------------------------------------------
Expand Down
18 changes: 9 additions & 9 deletions src/Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2147,6 +2147,15 @@ export const parseJson = <I, A extends string>(
)
}

/**
* The `ParseJson` schema offers a method to convert JSON strings into the `unknown` type using the underlying
* functionality of `JSON.parse`. It also employs `JSON.stringify` for encoding.
*
* @category string constructors
* @since 1.0.0
*/
export const ParseJson: Schema<string, unknown> = parseJson(string)

/**
* The `fromJson` combinator offers a method to convert JSON strings into the `A` type using the underlying
* functionality of `JSON.parse`. It also employs `JSON.stringify` for encoding.
Expand Down Expand Up @@ -2217,15 +2226,6 @@ export const ULID: Schema<string> = string.pipe(
})
)

/**
* The `ParseJson` schema offers a method to convert JSON strings into the `unknown` type using the underlying
* functionality of `JSON.parse`. It also employs `JSON.stringify` for encoding.
*
* @category string constructors
* @since 1.0.0
*/
export const ParseJson: Schema<string, unknown> = parseJson(string)

// ---------------------------------------------
// number filters
// ---------------------------------------------
Expand Down

0 comments on commit 8310159

Please sign in to comment.