-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: types don't resolve for @octokit/core
on esm.sh
#2762
Comments
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
This seems like an issue with That import path is defined in |
I honestly don't know if I'm doing something wrong, I also opened an issue with esm.sh about a bug with their deno cli integration, and they told me they're deprecating it, so maybe it's got something to do with the way that added it to my import map? here's what my import map looks like: "imports": {
"deno-slack-api/": "https://deno.land/x/[email protected]/",
"deno-slack-sdk/": "https://deno.land/x/[email protected]/",
"mock-fetch/": "https://deno.land/x/[email protected]/",
"@octokit/webhooks-types": "https://esm.sh/v135/@octokit/[email protected]",
"octokit": "https://esm.sh/v135/*[email protected]",
"@std/testing": "jsr:@std/testing@^1.0.5"
},
"scopes": {
"https://esm.sh/v135/": {
"@octokit/app": "https://esm.sh/v135/@octokit/[email protected]",
"@octokit/core": "https://esm.sh/v135/@octokit/[email protected]",
"@octokit/oauth-app": "https://esm.sh/v135/@octokit/[email protected]",
"@octokit/plugin-paginate-graphql": "https://esm.sh/v135/@octokit/[email protected]",
"@octokit/plugin-paginate-rest": "https://esm.sh/v135/@octokit/[email protected]",
"@octokit/plugin-rest-endpoint-methods": "https://esm.sh/v135/@octokit/[email protected]",
"@octokit/plugin-retry": "https://esm.sh/v135/@octokit/[email protected]",
"@octokit/plugin-throttling": "https://esm.sh/v135/@octokit/[email protected]",
"@octokit/request-error": "https://esm.sh/v135/@octokit/[email protected]",
"@octokit/types": "https://esm.sh/v135/@octokit/[email protected]"
}
}
|
@octokit/core
on esm.sh
@wolfy1339 I notice you linked the @octokit/core package.json, but the error is saying it's not defined in the octokit package, is octokit somehow supposed to inherit the import map from @octokit/core? (I genuinely have no idea how these things work) |
The Sorry, I meant export map It defines the exports of that package, in that case, there's 2 exports. The problem lies with esm.sh not using the export map in order to map the import to the correct file. In the mean time, try adding the following to your scopes "@octokit/core/types": "https://esm.sh/v135/@octokit/[email protected]/dist-types/types.d.ts", Also, to prevent any type errors ditch the |
Closing as there is nothing else actionable for Octokit itself |
@wolfy1339 thanks for the workaround. Though it seems this just moved on to something else :( $ deno check test.ts
error: Failed resolving types. Relative import path "node" not prefixed with / or ./ or ../ and not in import map from "https://esm.sh/v135/@octokit/[email protected]/dist-types/RequestRequestOptions.d.ts"
at https://esm.sh/v135/@octokit/[email protected]/dist-types/RequestRequestOptions.d.ts:1:22 it genuinely seems like I'm the only one doing this... |
please try to force it to use version 13.6.1 of @octokit/types |
my scopes already has this: "@octokit/types": "https://esm.sh/v135/@octokit/[email protected]" I seriously don't know how to do what you're asking |
Nevermind that. It's esm.sh keeping an old version of As for that error you are getting, it's TypeScript trying to shoehorn NodeJS typings into the project. The line in question is the following (https://unpkg.com/browse/@octokit/[email protected]/dist-types/RequestRequestOptions.d.ts) /// <reference types="node" resolution-mode="require"/> |
Will be fixed by octokit/types.ts#656 |
@wolfy1339 Can you elaborate a bit more? I use this package like this: import { WebhookEvent } from "@octokit/webhooks-types";
const handleWebhook = (payload) => {
const event = payload as WebhookEvent;
// type narrowing via stuff like this:
if ("state" in event) {
// TypeScript now considers event to be of type `StatusEvent`
}
} I can't figure out how to solve for my needs with @octokit/openapi-webhooks-types |
See https://github.com/octokit/webhooks.js/releases/tag/v13.0.0 The types were completely redone and are not compatible. import type { webhooks as OpenAPIWebhooks } from "@octokit/openapi-webhooks-types";
export type WebhookEventDefinition<TEventName extends keyof OpenAPIWebhooks> =
OpenAPIWebhooks[TEventName]["post"]["requestBody"]["content"]["application/json"];
export type StatusEvent = WebhookEventDefinition<"status">; I am working on making a transition package that drops in and replaces |
@wolfy1339 works perfect with no other code changes! ❤️ |
This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@octokit/types](https://redirect.github.com/octokit/types.ts) | [`13.6.1` -> `13.6.2`](https://renovatebot.com/diffs/npm/@octokit%2ftypes/13.6.1/13.6.2) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@octokit%2ftypes/13.6.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@octokit%2ftypes/13.6.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@octokit%2ftypes/13.6.1/13.6.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@octokit%2ftypes/13.6.1/13.6.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>octokit/types.ts (@​octokit/types)</summary> ### [`v13.6.2`](https://redirect.github.com/octokit/types.ts/releases/tag/v13.6.2) [Compare Source](https://redirect.github.com/octokit/types.ts/compare/v13.6.1...v13.6.2) ##### Bug Fixes - remove `@types/node` from generated types ([#​656](https://redirect.github.com/octokit/types.ts/issues/656)) ([730a26d](https://redirect.github.com/octokit/types.ts/commit/730a26dc2d919f19ed5401ffdf83286181da8772)), closes [/github.com/octokit/octokit.js/issues/2762#issuecomment-2486997620](https://redirect.github.com//github.com/octokit/octokit.js/issues/2762/issues/issuecomment-2486997620) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" in timezone Europe/Berlin, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/WtfJoke/setup-tectonic). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
@ThisGuyCodes "scopes": {
"https://esm.sh/v135/": {
"@octokit/app": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/core": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/core/types": "https://esm.sh/v135/@octokit/[email protected]/dist-types/types.d.ts",
"@octokit/oauth-app": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/plugin-paginate-graphql": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/plugin-paginate-rest": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/plugin-rest-endpoint-methods": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/plugin-retry": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/plugin-throttling": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/request-error": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/types": "https://esm.sh/v135/@octokit/[email protected]",
"@octokit/request": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/graphql": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"before-after-hook": "https://esm.sh/v135/[email protected]"
}
} I had to add the dependency override for esm.sh, as documented here: https://esm.sh/#specifying-dependencies The esm.sh deno thingy missed adding |
For some reason, TypeScript is including references to `@types/node` in the generated types. See octokit/types.ts#656 See octokit/octokit.js#2762 (comment)
For some reason, TypeScript is including references to `@types/node` in the generated types. See octokit/types.ts#656 See octokit/octokit.js#2762 (comment)
We still have this issue to contend with, esm-dev/esm.sh#995. I got rid of all I got {
"imports": {
"octokit": "https://esm.sh/v135/*[email protected]?target=deno",
"_http_agent": "node:_http_agent",
"_http_client": "node:_http_client",
"_http_common": "node:_http_common",
"_http_incoming": "node:_http_incoming",
"_http_outgoing": "node:_http_outgoing",
"_http_server": "node:_http_server",
"_stream_duplex": "node:_stream_duplex",
"_stream_passthrough": "node:_stream_passthrough",
"_stream_readable": "node:_stream_readable",
"_stream_transform": "node:_stream_transform",
"_stream_wrap": "node:_stream_wrap",
"_stream_writable": "node:_stream_writable",
"_tls_common": "node:_tls_common",
"_tls_wrap": "node:_tls_wrap",
"assert": "node:assert",
"assert/strict": "node:assert/strict",
"async_hooks": "node:async_hooks",
"buffer": "node:buffer",
"child_process": "node:child_process",
"cluster": "node:cluster",
"console": "node:console",
"constants": "node:constants",
"crypto": "node:crypto",
"dgram": "node:dgram",
"diagnostics_channel": "node:diagnostics_channel",
"dns": "node:dns",
"dns/promises": "node:dns/promises",
"domain": "node:domain",
"events": "node:events",
"fs": "node:fs",
"fs/promises": "node:fs/promises",
"http": "node:http",
"http2": "node:http2",
"https": "node:https",
"inspector": "node:inspector",
"inspector/promises": "node:inspector/promises",
"module": "node:module",
"net": "node:net",
"os": "node:os",
"path": "node:path",
"path/posix": "node:path/posix",
"path/win32": "node:path/win32",
"perf_hooks": "node:perf_hooks",
"process": "node:process",
"punycode": "node:punycode",
"querystring": "node:querystring",
"readline": "node:readline",
"readline/promises": "node:readline/promises",
"repl": "node:repl",
"stream": "node:stream",
"stream/consumers": "node:stream/consumers",
"stream/promises": "node:stream/promises",
"stream/web": "node:stream/web",
"string_decoder": "node:string_decoder",
"sys": "node:sys",
"timers": "node:timers",
"timers/promises": "node:timers/promises",
"tls": "node:tls",
"trace_events": "node:trace_events",
"tty": "node:tty",
"url": "node:url",
"util": "node:util",
"util/types": "node:util/types",
"v8": "node:v8",
"vm": "node:vm",
"wasi": "node:wasi",
"worker_threads": "node:worker_threads",
"zlib": "node:zlib"
},
"scopes": {
"https://esm.sh/v135/": {
"@octokit/app": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/auth-app": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/auth-unauthenticated": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/core": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/core/types": "https://esm.sh/v135/@octokit/[email protected]/dist-types/types.d.ts?target=deno",
"@octokit/oauth-app": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/plugin-paginate-graphql": "https://esm.sh/v135/@octokit/[email protected]?deps=@octokit/[email protected]",
"@octokit/plugin-paginate-rest": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/plugin-rest-endpoint-methods": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/plugin-retry": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/plugin-throttling": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/request-error": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/types": "https://esm.sh/v135/@octokit/[email protected]?target=deno",
"@octokit/webhooks": "https://esm.sh/v135/@octokit/[email protected]?target=deno"
}
}
}
|
What happened?
deno check ...
consistently errors when using octokit via esm.shVersions
Octokit.js v4.0.2
Deno v2.0.6
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: