Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,8 @@ interface Factory {

declare const factory: Factory

declare namespace factory {
export type Schema = AnySchema
}

export = factory
5 changes: 5 additions & 0 deletions test/typings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import createValidator = require('../')

const foo1: createValidator.Schema = { type: 'number' }
const foo2: createValidator.Schema = { type: 'array', items: { type: 'number' } }
const foo3: createValidator.Schema = { type: 'object', properties: { a: { type: 'number' } } }
const foo4: createValidator.Schema = { oneOf: [{ type: 'number' }, { type: 'string' }] }

/** Static assertion that `value` has type `T` */
// Disable tslint here b/c the generic is used to let us do a type coercion and
// validate that coercion works for the type value "passed into" the function.
Expand Down