Skip to content

Commit 7078f8b

Browse files
committed
fix Typescript reserved words #26
1 parent 9bbbbc5 commit 7078f8b

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

src/FluentSchema.d.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -126,30 +126,6 @@ interface DependenciesOptions {
126126
[key: string]: JSONSchema[]
127127
}
128128
export function withOptions<T>(options: SchemaOptions): T
129-
export function id<T>(id: string): T
130-
export function title<T>(title: string): T
131-
export function description<T>(description: string): T
132-
export function examples<T>(examples: Array<any>): T
133-
export function ref<T>(ref: string): T
134-
// FIXME enum is a reserved word
135-
// export function enum<T>(values: Array<any>): T
136-
// FIXME const is a reserved word
137-
// export function constant<T>(value: any): T
138-
export function required<T>(): T
139-
export function not<T>(schema: JSONSchema): T
140-
export function anyOf<T>(schema: Array<JSONSchema>): T
141-
export function allOf<T>(schema: Array<JSONSchema>): T
142-
export function oneOf<T>(schema: Array<JSONSchema>): T
143-
export function string(): StringSchema & BaseSchema<StringSchema>
144-
export function number(): NumberSchema & BaseSchema<NumberSchema>
145-
export function integer(): IntegerSchema & BaseSchema<IntegerSchema>
146-
export function boolean(): BooleanSchema & BaseSchema<BooleanSchema>
147-
export function array(): ArraySchema & BaseSchema<ArraySchema>
148-
export function object(): ObjectSchema & BaseSchema<ObjectSchema>
149-
// FIXME null is a reserved word
150-
// export function null(): NullSchema & BaseSchema<NullSchema>
151-
//FIXME LS we should return only a MixedSchema
152-
export function mixed<T>(types: TYPE[]): MixedSchema<T> & any
153129

154130
export interface S extends BaseSchema<S> {
155131
string: () => StringSchema
@@ -162,3 +138,6 @@ export interface S extends BaseSchema<S> {
162138
//FIXME LS we should return only a MixedSchema
163139
mixed: <T>(types: TYPE[]) => MixedSchema<T> & any
164140
}
141+
142+
declare var s: S
143+
export default s

src/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This file will be passed to the TypeScript CLI to verify our typings compile
22

3-
import S from '../FluentSchema'
3+
import S, { NumberSchema, StringSchema } from '../FluentSchema'
44

55
const schema = S.object()
66
.id('http://foo.com/user')
@@ -44,7 +44,7 @@ const schema = S.object()
4444
.prop('permissions')
4545
)
4646
.required()
47-
.prop('age', S.mixed<S.NumberSchema & S.StringSchema>(['string', 'integer']))
47+
.prop('age', S.mixed<NumberSchema & StringSchema>(['string', 'integer']))
4848

4949
.valueOf()
5050

0 commit comments

Comments
 (0)