Files
scriptc/tests/diagnostics/nested-member-blocker-path.ts
T
Malte UblandClaude Opus 5.5 5ffc20450e Compile SDK-declared data types, any-valued members and Pick views of classes
Message types from SDK declarations often use shapes scriptc refused:

- `{ [key: string]: any }` and `Dictionary<any>` (also a bare
  `Dictionary<T = any>`): the overflow values are checked-dynamic, like
  `Record<string, unknown>`'s.
- `any[]` members an interface, type literal or class declares, also
  optional or nullable: the checked-dynamic array, as `unknown[]` maps.
  An object literal's inferred `any[]` member keeps its existing story.
- A class a types-only package declares with public fields only (aws-sdk's
  `declare class PresignedPost { url: string; fields: Fields }`, with a
  merged namespace of types): it describes JSON data and is never
  constructed, so it maps structurally like an interface.
- `Pick<C, K>` and `Omit<C, K>` over a program class, when the view exposes
  a method: like an interface the class matches, it keeps a live receiver,
  so calls through the view run on the instance.

A record blocked by a member deep inside it now names that member's path
(`member 'poll().jobs[].handle' has type ...`) instead of the outermost
member only; a member holding `any` is named itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 20:55:04 -07:00

20 lines
534 B
TypeScript

// A record blocked by a member deep inside it names the member's path:
// through a function's result (`()`), the promise and union around it,
// record members (`.name`) and array elements (`[]`).
interface Job {
id: string;
handle: Promise<number> & { cancel(): void };
}
interface Order {
id: string;
jobs: Job[];
}
interface Provider {
name: string;
poll: () => Promise<Order | undefined>;
}
function makeProvider(): Provider {
return { name: "p", poll: async () => undefined };
}
console.log(makeProvider().name);