Skip to content

Commit 839bc0c

Browse files
committed
TS: Enable strict mode
1 parent f395cd0 commit 839bc0c

File tree

12 files changed

+24
-28
lines changed

12 files changed

+24
-28
lines changed

src/error/__tests__/formatError-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ describe('formatError: default error formatter', () => {
4545
});
4646

4747
it('rejects null and undefined errors', () => {
48-
// TODO ts-expect-error (formatError expects a value)
48+
// @ts-expect-error (formatError expects a value)
4949
expect(() => formatError(undefined)).to.throw(
5050
'Received null or undefined error.',
5151
);
5252

53-
// TODO ts-expect-error (formatError expects a value)
53+
// @ts-expect-error (formatError expects a value)
5454
expect(() => formatError(null)).to.throw(
5555
'Received null or undefined error.',
5656
);

src/execution/__tests__/abstract-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,9 @@ describe('Execute: Handles execution of abstract types', () => {
577577
);
578578

579579
// FIXME: workaround since we can't inject resolveType into SDL
580-
assertInterfaceType(schema.getType('Pet')).resolveType =
581-
// @ts-expect-error
582-
() => schema.getType('Cat');
580+
// @ts-expect-error
581+
assertInterfaceType(schema.getType('Pet')).resolveType = () =>
582+
schema.getType('Cat');
583583
expectError({ forTypeName: undefined }).toEqual(
584584
'Support for returning GraphQLObjectType from resolveType was removed in [email protected] please return type name instead.',
585585
);

src/subscription/__tests__/subscribe-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ describe('Subscription Initialization Phase', () => {
313313
}),
314314
});
315315

316-
// TODO ts-expect-error (schema must not be null)
316+
// @ts-expect-error (schema must not be null)
317317
(await expectPromise(subscribe({ schema: null, document }))).toRejectWith(
318318
'Expected null to be a GraphQL schema.',
319319
);
@@ -323,7 +323,7 @@ describe('Subscription Initialization Phase', () => {
323323
'Expected undefined to be a GraphQL schema.',
324324
);
325325

326-
// TODO ts-expect-error (document must not be null)
326+
// @ts-expect-error (document must not be null)
327327
(await expectPromise(subscribe({ schema, document: null }))).toRejectWith(
328328
'Must provide document.',
329329
);

src/subscription/mapAsyncIterator.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export function mapAsyncIterator<T, U, R = undefined>(
1919
}
2020

2121
try {
22-
// @ts-expect-error FIXME: TS Conversion
2322
return { value: await callback(result.value), done: false };
2423
} catch (error) {
2524
// istanbul ignore else (FIXME: add test case)

src/type/__tests__/definition-test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ describe('Type System: Objects', () => {
335335
const objType = new GraphQLObjectType({
336336
name: 'SomeObject',
337337
fields: {
338-
// TODO ts-expect-error (must not be undefined)
338+
// @ts-expect-error (must not be undefined)
339339
f: undefined,
340340
},
341341
});
@@ -699,7 +699,7 @@ describe('Type System: Enums', () => {
699699
() =>
700700
new GraphQLEnumType({
701701
name: 'SomeEnum',
702-
// TODO ts-expect-error (must not be null)
702+
// @ts-expect-error (must not be null)
703703
values: { FOO: null },
704704
}),
705705
).to.throw(
@@ -845,9 +845,9 @@ describe('Type System: List', () => {
845845
expectList(String).to.throw(
846846
'Expected [function String] to be a GraphQL type.',
847847
);
848-
// TODO ts-expect-error (must provide type)
848+
// @ts-expect-error (must provide type)
849849
expectList(null).to.throw('Expected null to be a GraphQL type.');
850-
// TODO ts-expect-error (must provide type)
850+
// @ts-expect-error (must provide type)
851851
expectList(undefined).to.throw('Expected undefined to be a GraphQL type.');
852852
});
853853
});
@@ -878,11 +878,11 @@ describe('Type System: Non-Null', () => {
878878
expectNonNull(String).to.throw(
879879
'Expected [function String] to be a GraphQL nullable type.',
880880
);
881-
// TODO ts-expect-error (must provide type)
881+
// @ts-expect-error (must provide type)
882882
expectNonNull(null).to.throw(
883883
'Expected null to be a GraphQL nullable type.',
884884
);
885-
// TODO ts-expect-error (must provide type)
885+
// @ts-expect-error (must provide type)
886886
expectNonNull(undefined).to.throw(
887887
'Expected undefined to be a GraphQL nullable type.',
888888
);

src/type/__tests__/validation-test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ describe('Type System: Object fields must have output types', () => {
10361036
}
10371037

10381038
it('rejects an empty Object field type', () => {
1039-
// TODO ts-expect-error (type field must not be undefined)
1039+
// @ts-expect-error (type field must not be undefined)
10401040
const schema = schemaWithObjectField({ type: undefined });
10411041
expect(validateSchema(schema)).to.deep.equal([
10421042
{
@@ -1098,7 +1098,7 @@ describe('Type System: Objects can only implement unique interfaces', () => {
10981098
const schema = new GraphQLSchema({
10991099
query: new GraphQLObjectType({
11001100
name: 'BadObject',
1101-
// TODO ts-expect-error (interfaces must not contain undefined)
1101+
// @ts-expect-error (interfaces must not contain undefined)
11021102
interfaces: [undefined],
11031103
fields: { f: { type: GraphQLString } },
11041104
}),
@@ -1357,7 +1357,7 @@ describe('Type System: Interface fields must have output types', () => {
13571357
}
13581358

13591359
it('rejects an empty Interface field type', () => {
1360-
// TODO ts-expect-error (type field must not be undefined)
1360+
// @ts-expect-error (type field must not be undefined)
13611361
const schema = schemaWithInterfaceField({ type: undefined });
13621362
expect(validateSchema(schema)).to.deep.equal([
13631363
{
@@ -1493,7 +1493,7 @@ describe('Type System: Arguments must have input types', () => {
14931493
}
14941494

14951495
it('rejects an empty field arg type', () => {
1496-
// TODO ts-expect-error (type field must not be undefined)
1496+
// @ts-expect-error (type field must not be undefined)
14971497
const schema = schemaWithArg({ type: undefined });
14981498
expect(validateSchema(schema)).to.deep.equal([
14991499
{
@@ -1631,7 +1631,7 @@ describe('Type System: Input Object fields must have input types', () => {
16311631
}
16321632

16331633
it('rejects an empty input field type', () => {
1634-
// TODO ts-expect-error (type field must not be undefined)
1634+
// @ts-expect-error (type field must not be undefined)
16351635
const schema = schemaWithInputField({ type: undefined });
16361636
expect(validateSchema(schema)).to.deep.equal([
16371637
{

src/utilities/__tests__/buildASTSchema-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ describe('Schema Builder', () => {
10951095
});
10961096

10971097
it('Rejects invalid AST', () => {
1098-
// TODO ts-expect-error (First parameter expected to be DocumentNode)
1098+
// @ts-expect-error (First parameter expected to be DocumentNode)
10991099
expect(() => buildASTSchema(null)).to.throw(
11001100
'Must provide valid Document AST',
11011101
);

src/utilities/__tests__/buildClientSchema-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ describe('Type System: build schema from introspection', () => {
629629
`);
630630

631631
it('throws when introspection is missing __schema property', () => {
632-
// TODO ts-expect-error (First parameter expected to be introspection results)
632+
// @ts-expect-error (First parameter expected to be introspection results)
633633
expect(() => buildClientSchema(null)).to.throw(
634634
'Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: null.',
635635
);

src/utilities/__tests__/extendSchema-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ describe('extendSchema', () => {
11431143
it('Rejects invalid AST', () => {
11441144
const schema = new GraphQLSchema({});
11451145

1146-
// TODO ts-expect-error (Second argument expects DocumentNode)
1146+
// @ts-expect-error (Second argument expects DocumentNode)
11471147
expect(() => extendSchema(schema, null)).to.throw(
11481148
'Must provide valid Document AST',
11491149
);

src/utilities/extendSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ export function extendSchemaImpl(
406406
// Note: While this could make early assertions to get the correctly
407407
// typed values below, that would throw immediately while type system
408408
// validation with validateSchema() will produce more actionable results.
409-
// TODO ts-expect-error
409+
// @ts-expect-error
410410
opTypes[operationType.operation] = getNamedType(operationType.type);
411411
}
412412
}

0 commit comments

Comments
 (0)