-
Notifications
You must be signed in to change notification settings - Fork 86
upgrade to TypeScript 6 #3171
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
base: master
Are you sure you want to change the base?
upgrade to TypeScript 6 #3171
Changes from all commits
1188c5e
d988280
9260f70
137fb96
0842bba
9826759
b8005ee
b199281
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| '@endo/bundle-source': minor | ||
| --- | ||
|
|
||
| `BundleCache.load()` now has a conditional return type based on the `format` option: | ||
| - Omitted (default) → `Promise<BundleSourceResult<'endoZipBase64'>>` | ||
| - Specific format literal → `Promise<BundleSourceResult<format>>` | ||
| - Runtime-typed `ModuleFormat` → `Promise<BundleSourceResult<ModuleFormat>>` | ||
|
|
||
| Previously `load()` returned `Promise<unknown>`, requiring callers to assert the bundle shape. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| '@endo/daemon': patch | ||
| --- | ||
|
|
||
| TypeScript 6 conformance: public types in `types.d.ts` are now more precise. | ||
|
|
||
| - `Context.thisDiesIfThatDies` and `thatDiesIfThisDies` parameters tightened from `string` to `FormulaIdentifier` (a branded string type). | ||
| - `RemoteControl` and `RemoteControlState` interface parameters updated from `Promise<EndoGateway>` to `ERef<EndoGateway>` and `cancelled` widened from `Promise<never>` to `Promise<unknown>`. | ||
| - `EndoInspector` generic type parameter renamed from `Record` to `RecordT` to avoid shadowing the built-in `Record` utility type. | ||
| - `SerialJobs.enqueue` parameter widened from `() => Promise<T>` to `() => T | Promise<T>`, matching the runtime behavior (the implementation already awaits the result, so sync callbacks were always supported). | ||
|
|
||
| TypeScript consumers implementing or calling these interfaces may need to update their types accordingly. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,12 +78,28 @@ export interface BundleCache { | |
| log?: Logger | undefined, | ||
| options?: BundleCacheOperationOptions | undefined, | ||
| ) => Promise<BundleMeta>; | ||
| load: ( | ||
| /** | ||
| * The result type is conditional on the `format` option: | ||
| * - omitted → `BundleSourceResult<'endoZipBase64'>` (the default) | ||
| * - present → `BundleSourceResult<format>` | ||
| * | ||
| * Callers that don't pass a `format` option get the default | ||
| * `endoZipBase64` shape directly. Callers that pass a known literal | ||
| * format get the corresponding bundle shape. Callers that pass a | ||
| * runtime-typed `ModuleFormat` get the union of all possible shapes. | ||
| */ | ||
| load: <Opts extends BundleCacheOperationOptions | undefined = undefined>( | ||
| rootPath: string, | ||
| targetName?: string | undefined, | ||
| log?: Logger | undefined, | ||
| options?: BundleCacheOperationOptions | undefined, | ||
| ) => Promise<unknown>; | ||
| options?: Opts, | ||
| ) => Promise< | ||
| Opts extends { format: infer F } | ||
| ? F extends ModuleFormat | ||
| ? BundleSourceResult<F> | ||
| : BundleSourceResult<'endoZipBase64'> | ||
| : BundleSourceResult<'endoZipBase64'> | ||
|
Comment on lines
+97
to
+101
|
||
| >; | ||
| } | ||
|
|
||
| export interface FileReader { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This JSDoc return-type conditional has the same issue as the exported
BundleCache.loadtype: checkingOpts extends { format: ... }will treatBundleCacheOperationOptions(whereformatis optional) as the “no format” case, narrowing the return type to the default even when a runtimeformatmay be present. Align this with the fixed signature (likely via overload-style JSDoc or by matchingformat?and extractingModuleFormat).