benjamn / ast-types

Esprima-compatible implementation of the Mozilla JS Parser API
MIT License
1.13k stars 195 forks source link

Can we add "TSSatisfiesExpression" to src/def/typescript.ts #935

Open skvale opened 1 year ago

skvale commented 1 year ago

Without TSSatisfiesExpression

/Users/me/project/node_modules/ast-types/lib/types.js:664
            throw new Error("did not recognize object of type " +
            ^

Error: did not recognize object of type "TSSatisfiesExpression"
    at Object.getFieldNames (/Users/me/project/node_modules/ast-types/lib/types.js:664:19)
    at visitChildren (/Users/me/project/node_modules/ast-types/lib/path-visitor.js:184:36)
    at PVp.visitWithoutReset (/Users/me/project/node_modules/ast-types/lib/path-visitor.js:166:20)
    at visitChildren (/Users/me/project/node_modules/ast-types/lib/path-visitor.js:203:25)
    at PVp.visitWithoutReset (/Users/me/project/node_modules/ast-types/lib/path-visitor.js:166:20)
    at NodePath.each (/Users/me/project/node_modules/ast-types/lib/path.js:87:26)
    at visitChildren (/Users/me/project/node_modules/ast-types/lib/path-visitor.js:178:18)
    at PVp.visitWithoutReset (/Users/me/project/node_modules/ast-types/lib/path-visitor.js:166:20)
    at visitChildren (/Users/me/project/node_modules/ast-types/lib/path-visitor.js:203:25)
    at PVp.visitWithoutReset (/Users/me/project/node_modules/ast-types/lib/path-visitor.js:166:20)

Node.js v18.12.1

"typescript": "^4.9.5",

TS docs: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#the-satisfies-operator

Example syntax ```ts type Colors = "red" | "green" | "blue"; type RGB = [red: number, green: number, blue: number]; const palette = { red: [255, 0, 0], green: "#00ff00", bleu: [0, 0, 255] } satisfies Record; ```
JamesNimlos commented 4 months ago

I believe this can be closed. It was implemented in https://github.com/benjamn/ast-types/pull/886 and others mentioned fixing this issue by upgrading to ast-types@0.16.1 or higher.