Skip to content

Commit

Permalink
fix ~ remove /// <reference path... references to deno types
Browse files Browse the repository at this point in the history
## [why]

Deno barfs to a halt with type conflict errors when it's not exactly in sync with the
otherwise referenced types, which is not controllable by the repository. So, remove any
references to Deno types from the TS files. Intellisense is broken by this but the code
will now run.

Both the built-in JS/TS plugin (vscode.typescript-language-features) and the
Deno-specific plugin (denoland.vscode-deno) are currently unable to understand and work
within a mixed repository.

Await better tooling.
  • Loading branch information
rivy committed Jan 11, 2021
1 parent cf6d6c4 commit 2bdd8f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
3 changes: 0 additions & 3 deletions eg/show-paths.remote.deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

/* eslint-disable no-console , security/detect-object-injection, security-node/detect-crlf , @typescript-eslint/ban-ts-comment , @typescript-eslint/no-explicit-any */

// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../src/types/deno.d.ts"/>

// @ts-ignore
import osPaths from 'https://cdn.jsdelivr.net/gh/rivy/js.os-paths@5b6b93bdb048098b86f9b8f0952180c2bf0532b1/src/mod.deno.ts';
// import osPaths from 'https://cdn.jsdelivr.net/gh/rivy/js.os-paths@2d5924e692617a575c8a73c9fb611e93085c4339/src/mod.deno.ts';
Expand Down
18 changes: 11 additions & 7 deletions src/platform-adapters/deno.deno.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
// spell-checker:ignore Deno

// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../types/deno.d.ts"/>

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import * as path from 'https://deno.land/std@0.81.0/path/mod.ts';

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* eslint-disable @typescript-eslint/ban-ts-comment */

// @ts-ignore
import { Platform } from './_base.ts';

// create a local reference to refer to `Deno` (for better linting without need for multiple `// @ts-ignore` directives)
// @ts-ignore
const deno = Deno;

export const adapter: Platform.Adapter = {
env: { get: Deno.env.get },
env: { get: deno.env.get },
// Deno (as of v1.6) has no built-in implementation for homedir() or tmpdir()
os: {}, // * module is tolerant of missing homedir()/tmpdir() functions
meta: { mainFilename: Deno.mainModule },
meta: { mainFilename: deno.mainModule },
path,
process: { platform: Deno.build.os },
process: { platform: deno.build.os },
};

/* eslint-enable @typescript-eslint/ban-ts-comment */

0 comments on commit 2bdd8f0

Please sign in to comment.