Update printer.ts to support kind = 'get'/'set' on TSMethodSignature

`TSMethodSignature` has a `kind` property which can be set to `method` (the default), `get`, and `set`. When `get` and `set`, the method is a getter or a setter, and as such, should be prefixed with either `get ` or `set `.
This commit is contained in:
Dan Dean 2024-01-02 17:22:54 -08:00 committed by GitHub
parent 7f441d2c74
commit f0f50943d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2335,6 +2335,12 @@ function genericPrintNoParens(path: any, options: any, print: any) {
return concat(parts);
case "TSMethodSignature":
if (n.kind === 'get') {
parts.push('get ')
} else if (n.kind === 'set') {
parts.push('set ')
}
if (n.computed) {
parts.push("[", path.call(print, "key"), "]");
} else {