Skip to content

Migrate seshat-node to Typescript - #200

Open
Half-Shot wants to merge 3 commits into
hs/switch-to-ox-suitefrom
hs/typescript
Open

Half-Shot wants to merge 3 commits into
hs/switch-to-ox-suitefrom
hs/typescript

Conversation

@Half-Shot

@Half-Shot Half-Shot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

This does a few things to migrate seshat-node to Typescript, and provide a type definition file.

This:

  • Replaces index.js with index.ts, closely following the same types.
  • Exports index.js / index.d.ts with a sourcemap included.
  • Updates the CI to lint these files.

Element Web may then remove it's own https://github.com/element-hq/element-web/blob/develop/apps/desktop/src/%40types/matrix-org-seshat.d.ts after this has made it into a release.

Add typescript and @types/node, a tsconfig that compiles src/ into
dist/, and a build:ts script that runs before the native build. The
package entry point and published files now point at dist/. Enable the
oxlint typescript plugin and ignore dist/ in oxlint and oxfmt.
Move index.js to src/index.ts and add types for the public API.

The ReindexError conversion checks the error's constructor name instead
of using `instanceof Error`, because errors from the native module can
come from a different realm (e.g. under jest).
Type check in the node-lint job, and build dist/ before publishing the
main package so it isn't published without its entry point.
@Half-Shot
Half-Shot changed the base branch from main to hs/switch-to-ox-suite October 6, 2026 15:26
@Half-Shot
Half-Shot added this pull request to stack #214 October 6, 2026 15:26
@Half-Shot
Half-Shot marked this pull request as ready for review October 6, 2026 15:29

@kaylendog kaylendog left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny comments! Sorry this took so long to review, I think got swept under the rug by Matrix conference and such.

Comment thread seshat-node/package.json
"build:ts": "tsc"
},
"devDependencies": {
"@types/node": "^26.2.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the minimum Node we support is 22 per .node-version in the repo root?

Suggested change
"@types/node": "^26.2.0",
"@types/node": "^22",

Or whatever. A later @types/node would let us easily introduce code the earlier versions don't support, I think? Further to that, a

"engines": { "node": ">=22" }

may be in order.

Comment thread seshat-node/tsconfig.json
Comment on lines +20 to +21
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we perhaps also enable noImplicitOverride, noPropertyAccessFromIndexSignature, noImplicitReturns and noFallthroughCasesInSwitch? I don't think src/index.ts is susceptible to any of these right now, these are just my preferences :3

Suggested change
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,

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

Successfully merging this pull request may close these issues.

2 participants