-
Notifications
You must be signed in to change notification settings - Fork 3
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
Make Octokit.ApiVersions
interface merging work with GHES additions in TypeScript
#9
Comments
Octokit.ApiVersions
interface merging work with GHES additionsOctokit.ApiVersions
interface merging work with GHES additions in TypeScript
Octokit.ApiVersions
interface merging work with GHES additions in TypeScriptOctokit.ApiVersions
interface merging work with GHES additions in TypeScript
I found out that what does work is if I set the But that should be inferred from the I also realized that the GHES-3.1 tests for JS create a custom class which sets the version type argument explicitly octokit-next.js/tests/js/ghes-3.1/index.d.ts Lines 1 to 15 in f376a96
While the TS tests does not do that octokit-next.js/tests/ts/ghes-3.1/test.ts Lines 1 to 18 in f376a96
|
I think I figured it out. I'll have to remove |
🎉 This issue has been resolved in version 1.3.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
@gr2m Hey I saw your post on the TS discord after you closed it but it looked interesting so I took a crack at it. If you're still looking at this, would something along these lines work? There's something I don't understand going on with |
Thanks a lot Nolan for the follow up! Setting I also removed The next challenge I see is to make it work when creating custom classes using the static import { Octokit } from "@octokit-next/core"
import "@octokit-next/types-rest-api-ghes-3.1"
const MyOctokit = Octokit.withDefaults({
version: "ghes-3.1"
})
const octokit = new MyOctokit()
octokit.request("GET /ghes-only") But that's another rabbit hole 🐰🕳️ I created a follow up issue for now #11 |
This is a follow up to #7
Here is a video summarizing the problem. The file I'm showing is
tests/ts/ghes-3.1/test.ts
2021-08-09.12-51-01.mp4
I also created a TypeScript playground with a very much simplified illustration of the problem I'm running into.
The
@octokit-next/*
packages are published from thepackages/
folders. They are written in JavaScript and hand-writtend.ts
files.When installing
@octokit-next/core
, then theversion
constructor parameter can only be set to"github.com"
and the only declared REST API endpoint is the root endpointGET /
.When installing
@octokit-next/types-rest-api-github.com
and importing it, then the additional endpoints show upHowever, when installing and importing
@octokit-next/types-rest-api-ghes-3.1
, then theversion
constructor option cannot be set to"ghes-3.1"
, although it is added as key to theOctokit.ApiVersions
interface:octokit-next.js/packages/types-rest-api-ghes-3.1/index.d.ts
Lines 52 to 63 in f376a96
I added tests for both JavaScript (using
tsd
) and TypeScript (usingtsc
) examples intests/js
andtests/ts
respectively.The JS/DTS tests are passing, but the TypeScript test for GHES-3.1 is failing. And I'm not sure why that isturns out the the JS/DTS tests used a custom class where I explicitly set the versions. I now added a newtests/js/ghes-3.1
test that fails just like its TypeScript counterpartThe text was updated successfully, but these errors were encountered: