Skip to content

Commit

Permalink
fix: Fix JSR publication errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vbudovski committed Jul 15, 2024
1 parent 95f6000 commit 28862d3
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 55 deletions.
2 changes: 2 additions & 0 deletions paseri-lib/deno.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"name": "@vbudovski/paseri",
"version": "0.1.0",
"exports": "./src/index.ts",
"imports": {
"@badrap/valita": "jsr:@badrap/valita@^0.3.8",
"@biomejs/biome": "npm:@biomejs/biome@^1.8.0",
Expand Down
10 changes: 5 additions & 5 deletions paseri-lib/src/schemas/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ArraySchema<ElementSchemaType extends AnySchemaType> extends Schema<Infer<

this._element = element;
}
protected _clone() {
protected _clone(): ArraySchema<ElementSchemaType> {
const cloned = new ArraySchema(this._element);
cloned._minLength = this._minLength;
cloned._maxLength = this._maxLength;
Expand Down Expand Up @@ -61,19 +61,19 @@ class ArraySchema<ElementSchemaType extends AnySchemaType> extends Schema<Infer<

return undefined;
}
min(length: number) {
min(length: number): ArraySchema<ElementSchemaType> {
const cloned = this._clone();
cloned._minLength = length;

return cloned;
}
max(length: number) {
max(length: number): ArraySchema<ElementSchemaType> {
const cloned = this._clone();
cloned._maxLength = length;

return cloned;
}
length(length: number) {
length(length: number): ArraySchema<ElementSchemaType> {
const cloned = this._clone();
cloned._minLength = length;
cloned._maxLength = length;
Expand All @@ -84,7 +84,7 @@ class ArraySchema<ElementSchemaType extends AnySchemaType> extends Schema<Infer<

function array<ElementSchemaType extends AnySchemaType>(
...args: ConstructorParameters<typeof ArraySchema<ElementSchemaType>>
) {
): ArraySchema<ElementSchemaType> {
return new ArraySchema(...args);
}

Expand Down
12 changes: 6 additions & 6 deletions paseri-lib/src/schemas/bigint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BigIntSchema extends Schema<bigint> {
TOO_LARGE: { type: 'leaf', code: 'too_large' },
} as const;

protected _clone() {
protected _clone(): BigIntSchema {
const cloned = new BigIntSchema();
cloned._checks = this._checks?.slice();

Expand All @@ -35,7 +35,7 @@ class BigIntSchema extends Schema<bigint> {

return undefined;
}
gte(value: bigint) {
gte(value: bigint): BigIntSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -46,7 +46,7 @@ class BigIntSchema extends Schema<bigint> {

return cloned;
}
gt(value: bigint) {
gt(value: bigint): BigIntSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -57,7 +57,7 @@ class BigIntSchema extends Schema<bigint> {

return cloned;
}
lte(value: bigint) {
lte(value: bigint): BigIntSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -68,7 +68,7 @@ class BigIntSchema extends Schema<bigint> {

return cloned;
}
lt(value: bigint) {
lt(value: bigint): BigIntSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -83,7 +83,7 @@ class BigIntSchema extends Schema<bigint> {

const singleton = new BigIntSchema();

function bigint() {
function bigint(): BigIntSchema {
return singleton;
}

Expand Down
4 changes: 2 additions & 2 deletions paseri-lib/src/schemas/boolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class BooleanSchema extends Schema<boolean> {
INVALID_TYPE: { type: 'leaf', code: 'invalid_type' },
} as const;

protected _clone() {
protected _clone(): BooleanSchema {
return new BooleanSchema();
}
_parse(value: unknown): InternalParseResult<boolean> {
Expand All @@ -20,7 +20,7 @@ class BooleanSchema extends Schema<boolean> {

const singleton = new BooleanSchema();

function boolean() {
function boolean(): BooleanSchema {
return singleton;
}

Expand Down
6 changes: 4 additions & 2 deletions paseri-lib/src/schemas/literal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LiteralSchema<OutputType extends LiteralType> extends Schema<OutputType> {

this._value = value;
}
protected _clone() {
protected _clone(): LiteralSchema<OutputType> {
return new LiteralSchema(this._value as IsLiteral<OutputType> extends true ? OutputType : never);
}
_parse(value: unknown): InternalParseResult<OutputType> {
Expand All @@ -28,7 +28,9 @@ class LiteralSchema<OutputType extends LiteralType> extends Schema<OutputType> {
}
}

function literal<OutputType extends LiteralType>(...args: ConstructorParameters<typeof LiteralSchema<OutputType>>) {
function literal<OutputType extends LiteralType>(
...args: ConstructorParameters<typeof LiteralSchema<OutputType>>
): LiteralSchema<OutputType> {
return new LiteralSchema(...args);
}

Expand Down
4 changes: 2 additions & 2 deletions paseri-lib/src/schemas/never.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class NeverSchema extends Schema<never> {
INVALID_TYPE: { type: 'leaf', code: 'invalid_type' },
} as const;

protected _clone() {
protected _clone(): NeverSchema {
return new NeverSchema();
}
_parse(value: unknown): InternalParseResult<never> {
Expand All @@ -16,7 +16,7 @@ class NeverSchema extends Schema<never> {

const singleton = new NeverSchema();

function never() {
function never(): NeverSchema {
return singleton;
}

Expand Down
4 changes: 2 additions & 2 deletions paseri-lib/src/schemas/null.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class NullSchema extends Schema<null> {
INVALID_VALUE: { type: 'leaf', code: 'invalid_value' },
} as const;

protected _clone() {
protected _clone(): NullSchema {
return new NullSchema();
}
_parse(value: unknown): InternalParseResult<null> {
Expand All @@ -21,7 +21,7 @@ class NullSchema extends Schema<null> {
const singleton = new NullSchema();

// `null` is a reserved word.
function null_() {
function null_(): NullSchema {
return singleton;
}

Expand Down
18 changes: 9 additions & 9 deletions paseri-lib/src/schemas/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class NumberSchema extends Schema<number> {
INVALID_SAFE_INTEGER: { type: 'leaf', code: 'invalid_safe_integer' },
} as const;

protected _clone() {
protected _clone(): NumberSchema {
const cloned = new NumberSchema();
cloned._checks = this._checks?.slice();

Expand All @@ -38,7 +38,7 @@ class NumberSchema extends Schema<number> {

return undefined;
}
gte(value: number) {
gte(value: number): NumberSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -49,7 +49,7 @@ class NumberSchema extends Schema<number> {

return cloned;
}
gt(value: number) {
gt(value: number): NumberSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -60,7 +60,7 @@ class NumberSchema extends Schema<number> {

return cloned;
}
lte(value: number) {
lte(value: number): NumberSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -71,7 +71,7 @@ class NumberSchema extends Schema<number> {

return cloned;
}
lt(value: number) {
lt(value: number): NumberSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -82,7 +82,7 @@ class NumberSchema extends Schema<number> {

return cloned;
}
int() {
int(): NumberSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -93,7 +93,7 @@ class NumberSchema extends Schema<number> {

return cloned;
}
finite() {
finite(): NumberSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -104,7 +104,7 @@ class NumberSchema extends Schema<number> {

return cloned;
}
safe() {
safe(): NumberSchema {
const cloned = this._clone();
cloned._checks = this._checks || [];
cloned._checks.push((_value) => {
Expand All @@ -119,7 +119,7 @@ class NumberSchema extends Schema<number> {

const singleton = new NumberSchema();

function number() {
function number(): NumberSchema {
return singleton;
}

Expand Down
8 changes: 4 additions & 4 deletions paseri-lib/src/schemas/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ObjectSchema<ShapeType extends ValidShapeType<ShapeType>> extends Schema<I

this._shape = new Map(Object.entries(shape));
}
protected _clone() {
protected _clone(): ObjectSchema<ShapeType> {
const cloned = new ObjectSchema(Object.fromEntries(this._shape.entries()) as ShapeType);
cloned._mode = this._mode;

Expand Down Expand Up @@ -146,13 +146,13 @@ class ObjectSchema<ShapeType extends ValidShapeType<ShapeType>> extends Schema<I
return undefined;
}

strict() {
strict(): ObjectSchema<ShapeType> {
const cloned = this._clone();
cloned._mode = 'strict';

return cloned;
}
passthrough() {
passthrough(): ObjectSchema<ShapeType> {
const cloned = this._clone();
cloned._mode = 'passthrough';

Expand All @@ -162,7 +162,7 @@ class ObjectSchema<ShapeType extends ValidShapeType<ShapeType>> extends Schema<I

function object<ShapeType extends ValidShapeType<ShapeType>>(
...args: ConstructorParameters<typeof ObjectSchema<ShapeType>>
) {
): ObjectSchema<ShapeType> {
return new ObjectSchema(...args);
}

Expand Down
4 changes: 2 additions & 2 deletions paseri-lib/src/schemas/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class RecordSchema<ElementSchemaType extends AnySchemaType> extends Schema<Infer

this._element = element;
}
protected _clone() {
protected _clone(): RecordSchema<ElementSchemaType> {
return new RecordSchema(this._element);
}
_parse(value: unknown): InternalParseResult<Infer<Record<string, ElementSchemaType>>> {
Expand Down Expand Up @@ -45,7 +45,7 @@ class RecordSchema<ElementSchemaType extends AnySchemaType> extends Schema<Infer

function record<ElementSchemaType extends AnySchemaType>(
...args: ConstructorParameters<typeof RecordSchema<ElementSchemaType>>
) {
): RecordSchema<ElementSchemaType> {
return new RecordSchema(...args);
}

Expand Down
4 changes: 2 additions & 2 deletions paseri-lib/src/schemas/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ abstract class Schema<OutputType> {

return { ok: false, issue: issueOrSuccess };
}
optional() {
optional(): OptionalSchema<OutputType> {
return new OptionalSchema(this);
}
nullable() {
nullable(): NullableSchema<OutputType> {
return new NullableSchema(this);
}
}
Expand Down
Loading

0 comments on commit 28862d3

Please sign in to comment.