Closed
Description
How to recreate the issue
Exactly same issues as: #274
Create a test project:
npm init -y && npm install typescript @octokit/types
Generates this package.json file:
{
"name": "test-repo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@octokit/types": "^6.11.0",
"typescript": "^4.2.2"
}
}
Create test.ts:
import { Endpoints } from '@octokit/types'
type listUserReposParameters = Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters']
const test: listUserReposParameters = {
name: '',
head_sha: '',
owner: '',
repo: '',
status: 'completed'
}
./node_modules/.bin/tsc test.ts
Gives the following error and the type that it constructed seems very broken:
test.ts:10:5 - error TS2322: Type 'string' is not assignable to type 'never'.
10 status: 'completed'
~~~~~~
node_modules/@octokit/openapi-types/dist-types/generated/types.d.ts:19876:21
19876 status?: "completed";
~~~~~~
The expected type comes from property 'status' which is declared here on type '{ owner: string; repo: string; check_run_id: number; } & Partial<{ status?: "completed"; } & { [key: string]: any; }> & Partial<{ status?: "queued" | "in_progress"; } & { [key: string]: any; }> & { ...; }'
Found 1 error.
Trying with v6.3.2 works:
npm install @octokit/types@6.3.2
tsc test.ts
Diff is here:
v6.3.2...v6.4.0