Repository navigation
feat(target-angular): emit cross-file types and generics - #78
Merged
Merged
Conversation
Angular's types lane (ADR-0067, ADR-0068). An output imports the types its source imports, by name, and its main component's file writes the module's type exports. A member another declaration declares is read from the props type by indexed access, `input<ButtonProps["tone"]>()`. A generic component is a generic class, and a scoped slot's context reads each type parameter as its constraint, or `any` without one, as ngtsc types a generic context it cannot infer (UF4004). The types and generics cases leave Angular's quarantine, with their consumer fixtures, the generic-slot-props gap, and the browser stand-in retired for the eight cases it served. Co-authored-by: multica-agent <github@multica.ai>
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://angular-types-generics-uxf-465-unframework.blue-water-0397.workers.dev (commit 90ba4aa)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
…them A seeded `??` or `!` over a member read from the props type by indexed access, `BadgeProps["note"]`, left its `undefined` in: the access is opaque to the type's text, so it now reads as `NonNullable<…>`, as an alias that admits a nullish value already does. Emit tests cover the narrowing with Angular's own check, the parentheses an inline props type takes, and the types a type parameter's constraint and default name. The test helper reads `types/exported-types` again, which imports nothing. Co-authored-by: multica-agent <github@multica.ai>
…ar-types-generics-uxf-465 # Conflicts: # tests/integration/harness/canaries.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Cross-file types and generic components on Angular (ADR-0067, ADR-0068). Only Angular's output changes.
import typeby name where the output reads the type:./typesor a package as written, and a child's types from its output (import Field, { type FieldProps } from "./field"). The output of a module's main component writes the module's type exports in source order among the types it declares. A member another declaration declares (inherited, intersected, picked or imported) is read from the props type by indexed access,input.required<BadgeProps["label"]>(), and with a defaultinput<Exclude<BadgeProps["tone"], undefined>, BadgeProps["tone"]>(…). A generic component is a generic class,export default class Table<T extends { id: string; label: string }>, whose type parameters ngtsc infers from a consumer's inputs. A slot directive can't infer them, so a scoped slot's context reads each one as its constraint, oranywithout one (generic-slot-props, UF4004). A select's model of a state of a type parameter takes the chosen value through the template's$any(…), since a template writes noas.types/(8),generics/(4) anddiagnostics/generic-slot-props, with Angular consumer fixtures for the 12 rendering cases, including thetypeand generic misuses. No shared expectation changes.generic-slot-propsgap is declared inCONSUMER_GAPS. Angular's test helpers read these cases again.??or!over a member read by indexed access now reads it asNonNullable<…>, soNonNullable<BadgeProps["note"]> | string, which ngtsc accepts. Emit tests cover that with Angular's own check, the parentheses an inline props type takes, and the types a type parameter's constraint and default name.class Table<T extends { id: string }>), with a unit test.Parity matrix
.ts: 8829 passed, 242 skipped, 0 failed. The matrix is green, every project ran, no missing cell and no stale entry. Every Angular cell of the 13 new cases passes, or skips where every target does (L9 without a scripted interaction, a diagnostics case's browser layers).pnpm test:updateleaves the tree clean.pnpm test:canaries: every canary caught on every case and target it corrupts, over two runs: L1 to L9 on the first commit, before a fix to the slot-context helper, and the six L10 to L13 canaries on the first pushed head. The fix commit after it changes no harness file and no golden output.Checklist
feat(web): sell the next framework on the homepage.pnpm format:check,pnpm lint,pnpm check-typesandpnpm testpass. (The first three pass. In place ofpnpm test: Angular's package tests, the repo tests, and the whole integration suite as above.)pnpm changeset(see.changeset/README.md).pnpm build, thenpnpm --filter web lighthouse, still scores at least 0.95 in every category.