Skip to content

Instantly share code, notes, and snippets.

export default class Queue {
private items: Array<() => Promise<void>> = [];
private waker: (() => void) | null = null;
constructor() {
this.processQueue().catch((err) => {
throw new Error(`Failed to process a queue: ${err}`);
});
}
@Zamiell
Zamiell / TSTL.md
Last active July 11, 2024 22:37
TypeScriptToLua & File Size

Introduction

Do you use TypeScriptToLua? Do you find the transpiled Lua output to be unsatisfying in some way? Please don't care about this. This blog will attempt to convince you why.


What is TSTL?

TypeScriptToLua, or TSTL for short, is a tool to automatically convert your TypeScript code to Lua.

@Zamiell
Zamiell / correspondence-problem.md
Last active August 20, 2024 23:35
Retsam's Correspondence Problem

(This post is originally from Retsam on the TypeScript Discord server).

There's a particular pattern that is safe but hard for the Typescript compiler to handle, which I call the "correspondence problem":

const functionsWithArguments = [
  { func: (arg: string) => {}, arg: "foo" },
  { func: (arg: number) => {}, arg: 0 },
];
yarn run v1.22.22
$ run-p lint:*
$ yarn update:eslint-docs --check
$ cross-env ESLINT_USE_FLAT_CONFIG=false eslint . --cache
$ tsc -p tsconfig.base.json --noEmit
$ eslint-doc-generator --rule-doc-title-format prefix-name --rule-doc-section-options false --rule-list-split meta.docs.category --ignore-config stage-0 --config-emoji recommended,☑️ --check
Please run eslint-doc-generator. A rule doc is out-of-date: docs\rules\consistent-type-specifier-style.md
- Expected
+ Received