Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
skvale opened this issue Mar 23, 2023 · 1 comment
Open

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

skvale opened this issue Mar 23, 2023 · 1 comment

Comments

@skvale
Copy link

skvale commented Mar 23, 2023

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
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<Colors, string | RGB>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants