octokit / octokit.js

The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.
MIT License
7.02k stars 1.03k forks source link

README refers to non-existant exported `Action` member #2094

Closed icetortoise closed 3 years ago

icetortoise commented 3 years ago

I am trying out the deno example in the README, and it does not work:

➜  deno_play deno --version
deno 1.10.1 (release, x86_64-apple-darwin)
v8 9.1.269.27
typescript 4.2.2

➜  deno_play cat issues.ts
import { Octokit, App, Action} from "https://cdn.skypack.dev/octokit?dts";

const o = new Octokit();
console.warn(`${JSON.stringify(o)}`);

➜  deno_play deno run issues.ts
Check file:~/Downloads/deno_play/issues.ts
error: TS2614 [ERROR]: Module '"https://cdn.skypack.dev/-/octokit@v1.0.4-H4m6Ye7oYVoZwgWiDmFe/dist=es2020,mode=imports/optimized/octokit.js"' has no exported member 'Action'. Did you mean to use 'import Action from "https://cdn.skypack.dev/-/octokit@v1.0.4-H4m6Ye7oYVoZwgWiDmFe/dist=es2020,mode=imports/optimized/octokit.js"' instead?
import { Octokit, App, Action} from "https://cdn.skypack.dev/octokit?dts";
                       ~~~~~~
    at file:~/Downloads/deno_play/issues.ts:1:24
wolfy1339 commented 3 years ago

This isn't a bug with deno, but with our documentation. There isn't any Action client in octokit.js as of yet.

You can use @octokit/action in the mean time

icetortoise commented 3 years ago

OK, thanks for looking into this so quickly.

I am still seeing issues though, the script looks like this now:

import { Octokit, App} from "https://cdn.skypack.dev/octokit?dts";

const o = new Octokit();
console.warn(`${JSON.stringify(o)}`);

This prints

{"log":{},"rest":{"actions":{},"activity":{},"apps":{},"billing":{},"checks":{},"codeScanning":{},"codesOfConduct":{},"emojis":{},"enterpriseAdmin":{},"gists":{},"git":{},"gitignore":{},"interactions":{},"issues":{},"licenses":{},"markdown":{},"meta":{},"migrations":{},"orgs":{},"packages":{},"projects":{},"pulls":{},"rateLimit":{},"reactions":{},"repos":{},"search":{},"secretScanning":{},"teams":{},"users":{}},"retry":{}}

However, if I try to access o.projects I get compilation error saying such property does not exist.

It seems like the type definitions are not picked up by tsc?

gr2m commented 3 years ago

it's o.rest.projects

gr2m commented 3 years ago

Also note that there is a known problem with Deno right now, likely related to our dependency on Bottleneck, see the thread at https://github.com/octokit/octokit.js/issues/2075

icetortoise commented 3 years ago

Thanks for the pointer.

o.rest.projects does not work either, compiler complains rest is missing in this case.

gr2m commented 3 years ago

It does work in the browser:

import("https://cdn.skypack.dev/octokit").then(pkg => {
  const octokit = new pkg.Octokit()
  console.log(octokit.rest.projects)
})

so I assume it's probably related to the problem described at #2075

gr2m commented 3 years ago

closing in favor of #2075