coderaiser / putout

🐊 Pluggable and configurable JavaScript Linter, code transformer and formatter, drop-in ESLint superpower replacement 💪 with built-in support for js, jsx, typescript, flow, markdown, yaml and json. Write declarative codemods in a simplest possible way 😏
https://putout.cloudcmd.io/
MIT License
712 stars 40 forks source link

`Error while loading rule 'putout/putout': Node type 'TSOptionalType' is not supported yet: 'number?'` #177

Closed ElPrudi closed 1 year ago

ElPrudi commented 1 year ago

Another quirky thing of TypeScript. You can actually define arrays that can have multiple lengths:

function test(arr: [number, number?]) {
    const x = arr[0] // arr[0] is type of number
    const y = arr[1] // arr[1] is type of number | undefined
}
ElPrudi commented 1 year ago

Ok, I just realized that this example does not trigger it and I'm currently working on when exactly it triggers.

ElPrudi commented 1 year ago

Ok, I just fixed a syntax error and it went magically away. Sorry for that.