-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilerarea: coreIssues related to the framework runtimeIssues related to the framework runtimecore: basic template syntaxfeatureIssue that requests a new featureIssue that requests a new feature
Milestone
Description
Which @angular/* package(s) are relevant/releated to the feature request?
compiler
Description
Currently, templates does not seems to support bigint literals.
Because of that, the following code does not compiles:
<!-- Argument of type 'number' is not assignable to parameter of type 'bigint'. -->
<button (click)="onClick(55n)"></button>onClick(v: bigint) {
console.log("clicked %o", v);
}The only way to get this to work it to either
- re-export the
BigIntfunction from the component code - use a variable defined in the component code
<button (click)="onClick(BigInt(55))"></button>
<button (click)="onClick(aBigInt)"></button>BigInt = BigInt;
aBigInt = 55n:
onClick(v: bigint) {
console.log("clicked %o", v);
}Proposed solution
Allow bigint literals (ending with n) in the templates and treat them as bigint not number.
Alternatives considered
Change nothing.
eneajaho, nakatchi, piotrroda, samuelfernandez, ErynManela and 4 more
Metadata
Metadata
Assignees
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilerarea: coreIssues related to the framework runtimeIssues related to the framework runtimecore: basic template syntaxfeatureIssue that requests a new featureIssue that requests a new feature