-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
editor config, trying to infer error types
- Loading branch information
Showing
3 changed files
with
39 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[[language]] | ||
name = "typescript" | ||
language-id = "typescript" | ||
scope = "source.ts" | ||
injection-regex = "^(ts|typescript)$" | ||
file-types = ["ts"] | ||
shebangs = ["deno"] | ||
roots = ["deno.json", "deno.jsonc", "package.json"] | ||
auto-format = true | ||
language-servers = ["deno-lsp"] | ||
|
||
[language-server.deno-lsp] | ||
command = "deno" | ||
args = ["lsp"] | ||
|
||
[language-server.deno-lsp.config.deno] | ||
enable = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,14 @@ import { err, ok, type Result, ResultAsync } from "npm:[email protected]"; | |
export type AnyFunction = (...args: never[]) => unknown; | ||
|
||
/** | ||
* | ||
* Create a new function that returns a Result type | ||
* Result<A,E>, where A is your return value and E is | ||
* the possible Error | ||
* | ||
* | ||
* In case of async functions, A ResultAsync<A,E> is returned | ||
* when an `await` keyword isn't used otherwise a Result<A,E> | ||
* of the resolved promise is returned | ||
* | ||
* | ||
* @param func The function being wrapped | ||
* @returns A new function that returns a Result Type (Result<A,E>) | ||
*/ | ||
|
@@ -39,5 +38,7 @@ export function makeSafeFunction<F extends AnyFunction>( | |
} catch (error) { | ||
return err(error instanceof Error ? error : new Error(String(error))); | ||
} | ||
// deno-lint-ignore no-explicit-any | ||
}) as any; | ||
// ^ aids type inference for some reason | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters