Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ClaudioHoffmann
Copy link
Contributor

Fixes #5176.

This is crucial especially for generated Angular wrappers. Previously,
if we had a property like

```ts
@Property({ type: String, reflect: true })
public placement: 'top' | 'bottom' = 'top';
```

the analyzer would widen its type to `string`. Then, the Angular
wrapper generator would emit

```ts
@input()
set placement(v: string) {
  this._ngZone.runOutsideAngular(() => (this._el.placement = v));
}
```

which fails type checking:

```
error TS2322: Type 'string' is not assignable to type '"top" | "bottom"'.
```
@changeset-bot
Copy link

changeset-bot bot commented Dec 10, 2025

🦋 Changeset detected

Latest commit: 5a1f5da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@lit-labs/analyzer Minor
@lit-labs/cli Patch
@lit-labs/compiler Patch
eslint-plugin-lit Patch
@lit-labs/gen-manifest Patch
@lit-labs/gen-utils Patch
@lit-labs/gen-wrapper-angular Patch
@lit-labs/gen-wrapper-react Patch
@lit-labs/gen-wrapper-vue Patch
@lit-labs/tsserver-plugin Patch
@lit-labs/vscode-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Collaborator

@justinfagnani justinfagnani left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @ClaudioHoffmann!

@justinfagnani justinfagnani merged commit e51a47b into lit:main Dec 18, 2025
7 checks passed
@lit-robot lit-robot mentioned this pull request Dec 18, 2025
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.

[labs/analyzer] Declared union types should be preserved

2 participants