From 4ec95d751948ffc9cc17db3ba44b742f37a1dea5 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Wed, 7 Apr 2021 17:33:17 +0300 Subject: [PATCH] Fix TS errors and add type check to CI --- .github/workflows/ci.yml | 3 +++ package.json | 3 ++- src/fake.ts | 4 +++- src/fake_schema.ts | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 631f4fa..8291048 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,9 @@ jobs: - name: Install Dependencies run: npm ci + - name: Check Types + run: npm run check + - name: Lint Prettier run: npm run prettier:check diff --git a/package.json b/package.json index 3b22eec..d33c8ea 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "node": ">= 8.x" }, "scripts": { - "test": "npm run prettier:check", + "test": "npm run check && npm run prettier:check", + "check": "tsc --noEmit", "start": "nodemon src/index.ts", "debug": "ts-node --inspect --compilerOptions '{\"inlineSources\":true}' src/index.ts", "start:editor": "webpack-dev-server --config webpack.config.js", diff --git a/src/fake.ts b/src/fake.ts index 7fe2c4e..5f1ef17 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -184,12 +184,14 @@ const fakeFunctions = { // System section // Skipped: faker.system.fileName - // TODO: Add ext and type + // TODO: Add ext + // @ts-expect-error Remove once fix is merged https://github.com/DefinitelyTyped/DefinitelyTyped/pull/52229 filename: () => faker.system.commonFileName(), mimeType: () => faker.system.mimeType(), // Skipped: faker.system.fileType // Skipped: faker.system.commonFileType // Skipped: faker.system.commonFileExt + // @ts-expect-error Remove once fix is merged https://github.com/DefinitelyTyped/DefinitelyTyped/pull/52229 fileExtension: () => faker.system.fileExt(), semver: () => faker.system.semver(), }; diff --git a/src/fake_schema.ts b/src/fake_schema.ts index 1bc8cd0..e87fd5d 100644 --- a/src/fake_schema.ts +++ b/src/fake_schema.ts @@ -143,7 +143,7 @@ export const fakeFieldResolver: GraphQLFieldResolver = async ( return args && (() => getRandomItem(args.values)); } - function getListLength(object): ListLengthArgs { + function getListLength(object) { const listLength = schema.getDirective('listLength'); const args = getDirectiveArgs(listLength, object) as ListLengthArgs; return args ? getRandomInt(args.min, args.max) : getRandomInt(2, 4);