$ deno --version
deno 1.0.0
v8 8.4.300
typescript 3.9.2
Operating systems: Windows 10, Ubuntu 16.04.
When running this Typescript file:
coretest.ts
console.log(Deno.core.ops());
Using this:
deno run --unstable coretest.ts
The result is:
error: TS2339 [ERROR]: Property 'core' does not exist on type 'typeof Deno'.
core is also not documented in the typedocs. Working around it with (Deno as any).core works, so the feature is available, it's just not typed correctly.
I found this issue when following the example here:
const rid = Deno.openPlugin("./path/to/some/plugin.so");
const opId = Deno.core.ops()["some_op"];
The end of https://doc.deno.land/https/raw.githubusercontent.com/denoland/deno/master/cli/js/lib.deno.unstable.d.ts says unstable, so it's unstable. Same solution as #5536 .
Probably need to change doc.deno.land to communicate that.
I was already running with the --unstable flag as you can see from the steps above. It appears that the core object is missing from the types. compile is not missing.
Deno.core is not intended to be a public API, therefore it is omitted from type definitions.
Is it worth noting that in the example, which _is_ in the type definitions, which uses Deno.core.ops()? At least noting that the example only works in JS and will fail to work in TS. It's probably only useful info for plugin developers at this point, to be fair, and they should be able to solve the problem themselves or find this issue report.
Deno.core is one of the places we didn鈥檛 finalize before 1.0. It鈥檚 necessary to access dispatch for plugins - but it鈥檚 generally stuff we don鈥檛 want to publicly expose. Unfortunately the current situation is that it鈥檚 exposed in the runtime but not in the types. We should probably just add the type definitions, since it鈥檚 in the runtime and it鈥檚 not obvious how we can remove it.
Since plugins _are_ publicly exposed (albeit behind --unstable) maybe Deno.plugins.ops or similar could be used as an alias to avoid mentioning core at all in the documentation.