Skip to content

Commit

Permalink
fix: typescript 4.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Aug 28, 2022
1 parent bb91ddd commit c878fd0
Show file tree
Hide file tree
Showing 4 changed files with 193 additions and 183 deletions.
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@
"postpack": "pinst --enable"
},
"devDependencies": {
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@commitlint/cli": "^17.1.1",
"@commitlint/config-conventional": "^17.1.0",
"@favware/cliff-jumper": "^1.8.7",
"@favware/npm-deprecate": "^1.0.5",
"@sapphire/eslint-config": "^4.3.8",
"@sapphire/prettier-config": "^1.4.4",
"@sapphire/ts-config": "^3.3.4",
"@types/jsdom": "^20.0.0",
"@types/lodash.uniqwith": "^4.5.7",
"@types/node": "^18.0.5",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
"@types/node": "^18.7.13",
"@typescript-eslint/eslint-plugin": "^5.35.1",
"@typescript-eslint/parser": "^5.35.1",
"@vitest/coverage-c8": "^0.22.1",
"cz-conventional-changelog": "^3.3.0",
"esbuild-plugins-node-modules-polyfill": "^1.0.4",
"eslint": "^8.22.0",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.1",
Expand All @@ -57,10 +57,11 @@
"pinst": "^3.0.0",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"tsup": "^6.2.2",
"typedoc": "^0.23.10",
"ts-node": "^10.9.1",
"tsup": "^6.2.3",
"typedoc": "^0.23.11",
"typedoc-plugin-mdn-links": "^2.0.0",
"typescript": "^4.7.4",
"typescript": "^4.8.2",
"vitest": "^0.22.1"
},
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Shapes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TypedArray, TypedArrayName } from '../constraints/util/typedArray';
import type { Unwrap, UnwrapTuple } from '../lib/util-types';
import type { NonNullObject, Unwrap, UnwrapTuple } from '../lib/util-types';
import {
ArrayValidator,
BaseValidator,
Expand Down Expand Up @@ -46,8 +46,8 @@ export class Shapes {
return new DateValidator();
}

public object<T>(shape: MappedObjectValidator<T>) {
return new ObjectValidator(shape);
public object<T extends NonNullObject>(shape: MappedObjectValidator<T>) {
return new ObjectValidator<T>(shape);
}

public get undefined() {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/util-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export type MappedObjectValidator<T> = { [key in keyof T]: BaseValidator<T[key]>
* });
* ```
*/
export type SchemaOf<T> = ObjectValidator<T>;
export type SchemaOf<T extends NonNullObject> = ObjectValidator<T>;

/**
* Infers the type of a schema object given `typeof schema`.
Expand Down
Loading

0 comments on commit c878fd0

Please sign in to comment.