Commit 8e49611
authored
fix: run type tests under TypeScript 6 and add missing response fields (#1780)
## CLA
- [ ] I have signed the [Stream
CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform)
(required).
- [x] Code changes are tested
## Description of the changes, What, Why and How?
Two related changes, both driven by getting `yarn test-types` healthy
again.
### 1. Run the API type-definition tests under TypeScript 6
**What / Why.** TypeScript was bumped to `^6.0.3` in #1742. TS6 makes it
a **hard error (TS5112)** to specify files on the command line while a
`tsconfig.json` is in scope:
```
error TS5112: tsconfig.json is present but will not be loaded if files are
specified on commandline. Use '--ignoreConfig' to skip this error.
```
`run-types-gen` did exactly that (`tsc … test/typescript/*.ts`), so
every `yarn test-types` run failed. (It only ever surfaced in the weekly
**Scheduled tests** job — `type.yml` is disabled — and the 3× retry
can't help a deterministic error.)
**How.**
- `run-types-gen` now runs `tsc -p test/typescript/tsconfig.json`
(project mode — no files on the command line, so no TS5112).
- That config now **extends the root `tsconfig.json`** so module
resolution (`moduleResolution: bundler`) and `skipLibCheck` match what
`yarn build` emits — without it, `tsc`'s bare CLI defaults fail on
`TS1340` for the emitted `import("ws")` type in
`dist/types/insights.d.ts`.
- Added `noEmit: true` (the old config had none, so on error `tsc`
emitted stray `.js` files).
The SDK source itself was already TS6-clean (`yarn
types`/`build`/`lint`/unit tests all pass under TS 6.0.3).
### 2. Add missing fields to API response types
With the type tests running again, they surfaced three fields the live
API returns that the SDK response types didn't declare (the same drift
already failing the scheduled job back in May). Added as optional
fields:
- `received_at` → `ConnectionOpen`
- `is_confusable_folding_enabled` → `BlockList` / `BlockListResponse`
- `feed_audit_logs_enabled` → `AppSettingsAPIResponse.app`
### Verification
- **Local (TS 6.0.3):** TS5112 gone; `run-types-gen` confirmed to still
catch drift; all three new fields recognized after rebuild; `yarn
types`, `yarn build`, `yarn lint`, `yarn vitest run` green.
- **End-to-end:** ran the real `yarn test-types` against the live API by
dispatching the Scheduled tests workflow on this branch. The first run
proved TS5112 was gone and failed only on the three drift fields above;
a follow-up run after adding the fields confirms the result (see
comments).
## Changelog
- Add optional `received_at` (`ConnectionOpen`),
`is_confusable_folding_enabled` (`BlockList`/`BlockListResponse`) and
`feed_audit_logs_enabled` (app settings) to the response types.
- Internal: the API type-definition tests (`yarn test-types`) now run
under TypeScript 6.1 parent ae1c97e commit 8e49611
3 files changed
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
2533 | 2535 | | |
2534 | 2536 | | |
2535 | 2537 | | |
| 2538 | + | |
2536 | 2539 | | |
2537 | 2540 | | |
2538 | 2541 | | |
| |||
2692 | 2695 | | |
2693 | 2696 | | |
2694 | 2697 | | |
| 2698 | + | |
2695 | 2699 | | |
2696 | 2700 | | |
2697 | 2701 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
2 | 12 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
8 | 17 | | |
0 commit comments