Closed gr2m closed 1 year ago
In case it's helpful, some more context. Here is an example deno script:
import { Octokit } from "https://esm.sh/@octokit-next/core";
import "https://esm.sh/@octokit-next/types-rest-api";
const octokit = new Octokit();
const { data } = await octokit.request("GET /");
// should be typed as string
data.current_user_url
When editing the above code in VS Code with the Deno extension, data
is typed as unknown.
If the https://esm.sh/@octokit-next/types-rest-api import would work as expected, data.current_user_url
would be typed as string. See this typescript playground for comparison
I was able to workaround the problem by adding a dummy export to the package: https://esm.sh/@octokit-next/types-rest-api@2.5.1
thanks for the details, I will add support for type only package!
@ije did you have a chance to look into it? No worries if not, just checking in
currently if you import module from https://github.com/@types/react, it will redirect to https://esm.sh/v104/@types/react@18.0.27/index.d.ts, i don't know if it works for types-rest-api
? i saw you added a workaround to exports, maybe just remove it?
the problem persists.
# no "x-typescript-types" header in v2.5.0
curl https://esm.sh/@octokit-next/types-rest-api@2.5.0\?dev -I | grep x-typescript-types:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 21 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0
# header is present after adding a dummy code export
curl https://esm.sh/@octokit-next/types-rest-api@2.5.1\?dev -I | grep x-typescript-types:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 278 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
x-typescript-types: https://esm.sh/v104/@octokit-next/types-rest-api@2.5.1/index.d.ts
ok, i will fix this asap, thanks
Hi @ije. My team is blocked by this in https://github.com/replicate/openapi
Anything needed to help unblock a fix for it?
Hi @ije. My team is blocked by this in https://github.com/replicate/openapi
@zeke I'm trying to fix this, but i can't access the repository, can you please provide a npm name instead? thanks!
In case it's helpful, some more context. Here is an example deno script:
import { Octokit } from "https://esm.sh/@octokit-next/core"; import "https://esm.sh/@octokit-next/types-rest-api"; const octokit = new Octokit(); const { data } = await octokit.request("GET /"); // should be typed as string data.current_user_url
When editing the above code in VS Code with the Deno extension,
data
is typed as unknown.If the https://esm.sh/@octokit-next/types-rest-api import would work as expected,
data.current_user_url
would be typed as string. See this typescript playground for comparison
i fixed the x-typescript-types
header in v119, but can not get the demo to work
i fixed the
x-typescript-types
header in v119, but can not get the demo to work
Might be something else.
I can confirm that the access-control-expose-headers
header is now set
curl https://esm.sh/@octokit-next/types-rest-api@2.5.0\?dev -I
HTTP/2 200
date: Tue, 16 May 2023 16:58:34 GMT
content-type: application/javascript; charset=utf-8
access-control-allow-origin: *
cache-control: public, max-age=86400
vary: Origin,User-Agent
access-control-allow-methods: *
access-control-expose-headers: X-TypeScript-Types
x-typescript-types: https://esm.sh/v121/@octokit-next/types-rest-api@2.5.0/index.d.ts
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=qbLGsa2Dg%2BgvjV3aVJHoHl5vo3YusUEP4J6%2FljsZNQK5PtZcK19h36Kfke9jwbizWPziBtd7I%2BCainXfgbG%2FXiaBvOoct18d%2BLWRThjsClxrCJ5LQxc65fQ%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 7c852a8d6aa67c67-LAX
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
I think it's safe to close this issue. I'll open a new one once I find out what causes the problem with the Deno Script.
@gr2m thanks 🙏
Failing module
@octokit-next/types-rest-api@2.5.0
Error message
No error message. The
x-typescript-types
response header is not on esm.sh/@octokit-next/types-rest-api although they are specified, and although they existAdditional info