Skip to content

How to infer required properties in Angular and Lit with decorators? #20988

Answered by Marklb
kasperpeulen asked this question in General
Discussion options

You must be logged in to vote

For Angular, runtime or maybe compile errors could probably be done, but I don't think enough can be gathered from just Typescript.

The following are why I think it would be difficult for Angular, but maybe someone would know a way to get around them:

Until runtime, when the decorators can be called, or compile time, when metadata properties can be set, there isn't anything unique about a component class. I could be wrong, but I don't think types can recognize that something has a decorator that will be called on it.

If you have the following component:

@Component({
  selector: 'example',
  inputs: [ 'inp1' ],
})
class ExampleComponent {
  static ngAcceptInputType_inp3: string | boolean | n…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by valentinpalkovic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment