Closed
Description
Bug Report
π Search Terms
typescript
jsx
tsx
generic
arrow function
default value
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about generics.
β― Playground Link
Playground link with relevant code
π» Code
import React from 'react'
const myFunc = <T = string,>() => {
}
π Actual behavior
The typescript compiler throws multiple errors
π Expected behavior
I would be allowed to create an arrow function with a single type parameter that has a default value.
Note:
- This happens only on with JSX enabled
- Removing the default value (
= string
) doesn't throw errors - Adding a second type parameter before
T
, ie<K, T=string>
doesn't throw errors