Skip to content

feat(typespec): add expression components and model property defaults#410

Open
glecaros wants to merge 7 commits into
feature/typespecfrom
feature/typespec-expressions
Open

feat(typespec): add expression components and model property defaults#410
glecaros wants to merge 7 commits into
feature/typespecfrom
feature/typespec-expressions

Conversation

@glecaros

Copy link
Copy Markdown

New components:

  • ArrayExpression: renders Type[] array syntax
  • IntersectionExpression: renders A & B intersection syntax
  • SpreadExpression: renders ...Type spread syntax for models and enums

Enhanced:

  • ModelProperty: add optional 'default' prop for default values

glecaros and others added 3 commits May 28, 2026 22:03
New components:
- ArrayExpression: renders Type[] array syntax
- IntersectionExpression: renders A & B intersection syntax
- SpreadExpression: renders ...Type spread syntax for models and enums

Enhanced:
- ModelProperty: add optional 'default' prop for default values

All components include JSDoc with @example blocks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix SpreadExpression JSDoc to use plain string instead of unexplained refkey
- Fix ModelProperty JSDoc example to include StatementList wrapper
- Add StatementList integration test for SpreadExpression
- Add cross-file reference test for SpreadExpression with import generation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ypespec-expressions

# Conflicts:
#	packages/typespec/src/components/index.ts
@glecaros glecaros force-pushed the feature/typespec-expressions branch from f17b494 to 6600433 Compare May 29, 2026 16:33

export interface ArrayExpressionProps {
/** The element type of the array. */
type: Children;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should that be children?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should for stuff like this

…ypespec-expressions

# Conflicts:
#	packages/typespec/src/components/index.ts
glecaros and others added 2 commits June 3, 2026 22:35
Brings in main merge and lockfile fix from feature/typespec.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Jun 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/typespec@410

commit: b323095

…ypespec-expressions

# Conflicts:
#	packages/typespec/src/components/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants