Skip to content

Add election api typescript - #166

Open
kodikos wants to merge 17 commits into
bbc:mainfrom
kodikos:add-election-api-typescript
Open

Add election api typescript#166
kodikos wants to merge 17 commits into
bbc:mainfrom
kodikos:add-election-api-typescript

Conversation

@kodikos

@kodikos kodikos commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What?

This is restoring the typescript port of the election api test that Rossano did. With some tweaks to freshen it.

Why?

We're appearing a bit dated when we give users pure JS tests. In some cases, we specifically want to assess their typescript abilities, and this hasn't been possible with these standard tests.

Rossano D'Angelo and others added 12 commits June 2, 2023 12:26
This commit creates the skeleton application of election-api-javascript in a TypeScript environment.
… files

Added Jest configuration for TypeScript support and copied JSON test files from election-api-javascript.
Co-authored-by: Allan Mckinlay <122284042+amckinlaybbc@users.noreply.github.com>
Co-authored-by: Paul Douglas Brimicombe <paul.brimicombe@bbc.co.uk>
Co-authored-by: Paul Douglas Brimicombe <paul.brimicombe@bbc.co.uk>
Co-authored-by: Paul Douglas Brimicombe <paul.brimicombe@bbc.co.uk>
…the store

As per comment, I'm returning null to rely on a message that indicates the new data has been created successfully.
Result | null was incompatible with the result type of the function.
Co-authored-by: Paul Douglas Brimicombe <paul.brimicombe@bbc.co.uk>

@iuketaylor iuketaylor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

copied from slack convo

The TS code looks good, as an MVP could probably get away with just updating the TS/node/dependency versions and verifying the tests still work

Everything i'd probably change to modernise it:

  • Node 18 EOL - move to LTS
  • TS 5.1.3 - move to 7.0.2 (probably restricting candidates if we stay on 5)
  • Express/other deps need updating
  • Replace jest with vitest (nightmare to work with TS)
  • replace ts-node/ts-node-dev with tsx
  • convert from commonJS to ESM
  • Update readme instructions to install latest stuff
  • Update any links referencing old js files

Comment thread election-api-typescript/tasks.md Outdated
Comment thread election-api-typescript/tasks.md Outdated
Comment thread election-api-typescript/.nvmrc Outdated
Comment thread election-api-typescript/package.json Outdated
Comment thread election-api-typescript/README.md Outdated
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