cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Future ts/js language features to apply

Open phillco opened this issue 1 year ago • 0 comments

Just for tracking the next time "we" (well, technically VS Code [1]) upgrade the TypeScript compiler version or the runtime, these are the smaller things we can bring along.

TypeScript 5.2 + ES2022 target

using

https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/#using-declarations-and-explicit-resource-management

async function writeCommunityFile(snippetFile: SnippetFile, filePath: string) {
  const snippetText = serializeSnippetFile(snippetFile);
  using file = await fs.open(filePath, "wx");
  await file.write(snippetText);
  // No need to explicitly close - it will be automatically disposed
}

For this to work, you need:

  • TypeScript 5.2 or later
  • The target compiler option set to "ES2022" or later
  • The lib compiler option to include "ES2024.Symbol" or later

[1] although now we also have to include QuickJS, the Cursorless JetBrains embedded JavaScript runtime as well 🤔. Ideally we could have a sense for how easily those are to upgrade

phillco avatar Jan 28 '25 19:01 phillco