Skip to content

feat(typespec): add scalar initializers, fix name policy, export miss…#415

Open
glecaros wants to merge 4 commits into
feature/typespecfrom
feature/typespec-scalar-init
Open

feat(typespec): add scalar initializers, fix name policy, export miss…#415
glecaros wants to merge 4 commits into
feature/typespecfrom
feature/typespec-scalar-init

Conversation

@glecaros

@glecaros glecaros commented Jun 5, 2026

Copy link
Copy Markdown

…ing components

  • Add ScalarInitializer component with doc/decorators support
  • Update ScalarDeclaration to accept children for body content
  • Replace incomplete keyword list with full TypeSpec keywords from compiler
  • Fix name policy to properly detect invalid identifiers (not just 5 words)
  • Export Reference, Parameters, and ScalarDeclaration from components index
  • Export components, contexts, and name-policy from package index

…ing components

- Add ScalarInitializer component with doc/decorators support
- Update ScalarDeclaration to accept children for body content
- Replace incomplete keyword list with full TypeSpec keywords from compiler
- Fix name policy to properly detect invalid identifiers (not just 5 words)
- Export Reference, Parameters, and ScalarDeclaration from components index
- Export components, contexts, and name-policy from package index

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@glecaros glecaros requested a review from timotheeguerin June 5, 2026 01:06
…tor export

Replace ValueOrArray<T> and Optional<T> convenience types with inline
T | T[] and T | undefined respectively. This fixes the api-extractor
'ae-forgotten-export' error for ValueOrArray exposed through Namespace
component props.

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

pkg-pr-new Bot commented Jun 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 5ef5b4c

glecaros and others added 2 commits June 16, 2026 18:27
Split keywords into active, reserved, and modifier categories matching
the TypeSpec compiler's syntax-utils.ts and formatter printer.ts:

- Active keywords (model, enum, op, etc.): escaped in all positions
- Reserved keywords (prop, record, trait, etc.): escaped only in
  declaration positions, not in member positions (model-property,
  enum-member, union-variant, decorator)
- Modifier keywords (extern, internal): never escaped (contextual)

This matches the TypeSpec formatter's allow-reserved/disallow-reserved
context logic used in printIdentifier().

Add comprehensive name policy tests (126 test cases).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant