Skip to content

Commit

Permalink
fix(instanceOf): fix output type
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed Jul 16, 2020
1 parent cd32278 commit 94410f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ export const record = <K extends string | number | symbol, V>(
value: Type<V>
): RecordType<K, V> => new RecordType(key, value)

export const instanceOf = <T extends { new (...args: any[]): any }>(
classType: T
): Type<T> => new InstanceOfType(classType)
export const instanceOf = <T>(classType: {
new (...args: any[]): T
}): Type<T> => new InstanceOfType(classType)

export const tuple = <T extends Type<any>[]>(
...types: T
Expand Down
8 changes: 3 additions & 5 deletions src/types/InstanceOfType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import Type from './Type'
import getErrorMessage from '../getErrorMessage'
import Validation, { ErrorTuple, IdentifierPath } from '../Validation'

export default class InstanceOfType<
T extends { new (...args: any[]): any }
> extends Type<T> {
export default class InstanceOfType<T> extends Type<T> {
typeName = 'InstanceOfType'
classType: T
classType: { new (...args: any[]): T }

constructor(classType: T) {
constructor(classType: { new (...args: any[]): T }) {
super()
this.classType = classType
}
Expand Down

0 comments on commit 94410f8

Please sign in to comment.