Losing this by passing a method as a callback
Passing obj.exec into a list strips this, so stateful plugins crash. Bind it, wrap it, or use an arrow field. Here is the GitProxy fix.
Read the entry →9 entries tagged “typescript”.
Passing obj.exec into a list strips this, so stateful plugins crash. Bind it, wrap it, or use an arrow field. Here is the GitProxy fix.
Read the entry →p.chains?.includes(name) dropped every plugin that omitted chains. Optional chaining in a filter is an accidental deny; default with ?? instead.
Read the entry →Record<string, T> types every key as present, so a typo compiled and getChain returned undefined. Thirteen tests failed from one missing key.
Read the entry →How to write a GitProxy plugin: a complete diff-scanning example, how to pick the right chain phase, and why a plugin can load and still never run.
Read the entry →A subclass field declaration overwrites what the base constructor assigned. useDefineForClassFields is why, and declare is the one-line fix.
Read the entry →Package subpath is not defined by exports, plus ts(2307): the file exists, the exports map hides it. Here's how to import a public type instead.
Read the entry →How to design a plugin system: named phases instead of positions, deny-by-default placement, and the defaults that must live outside your constructor.
Read the entry →Vitest 3 test fails with vi.mocked(...).mockResolvedValue is not a function after restoreAllMocks. Here's how to fix it in one line.
Read the entry →How to fix all the ESM mocking errors when moving GitProxy's test suite from Mocha, Chai, Sinon and proxyquire to Vitest + TypeScript
Read the entry →