From 08ae382212d51fec54e45610c50f3c3896ed99e2 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Sat, 26 Dec 2020 20:03:42 +0300 Subject: [PATCH] fix(utils): async resolve types --- .vscode/settings.json | 4 ++++ src/utils/resolve-async.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..ccfdaffa --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "typescript.tsdk": "node_modules/typescript/lib", + "deno.enable": false +} diff --git a/src/utils/resolve-async.ts b/src/utils/resolve-async.ts index ebf6c147..30003558 100644 --- a/src/utils/resolve-async.ts +++ b/src/utils/resolve-async.ts @@ -2,5 +2,6 @@ import resolveAsync, { AsyncOpts } from "resolve"; export default async (id: string, options: AsyncOpts = {}): Promise => new Promise((resolve, reject) => { - resolveAsync(id, options, (err, res) => (err ? reject(err) : resolve(res))); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- always present if there is no error + resolveAsync(id, options, (err, res) => (err ? reject(err) : resolve(res!))); });