Skip to content

Conversation

@mattbasta
Copy link
Contributor

I've been working on a Koa+typescript port of scimmy-routers, and these were some issues that came up along the way.

  1. First, the parameters for SCIMError should use the appropriate union types.
  2. scimType is often (always?) passed null in scimmy-routers, but this is disallowed by the type signatures.
  3. There is an unused import in resource.js
  4. The constructor for Types.Resource is incomplete. As-is, the type signature doesn't accept the value of config for the first argument. Marking a parameter as optional does not allow subsequent arguments to be passed in its place. Instead, you must provide an @overload for each valid signature.

I'm not sure whether these changes are interesting to you, but I figured I'd provide the backported (typescript -> jsdoc) version in case someone else might run up against these.

@sleelin sleelin added bug Something isn't working documentation Improvements or additions to documentation labels Oct 26, 2025
@sleelin sleelin self-assigned this Oct 26, 2025
@sleelin sleelin merged commit 45bcb19 into scimmyjs:main Oct 26, 2025
3 checks passed
@sleelin sleelin added this to the 1.3.6 milestone Oct 26, 2025
@sleelin
Copy link
Collaborator

sleelin commented Oct 26, 2025

Hi @mattbasta,
Apologies for the delay in addressing this PR and thanks for putting it together!
I made a minor change to the overloaded signatures in the resource constructor, but otherwise this has been merged and will be included in the next release!

Out of interest, were there many changes needed to port scimmy-routers to Koa? Both scimmy and scimmy-routers packages should include fairly complete type annotations which should allow for drop-in use in TypeScript projects?

Thanks,
Sam

@mattbasta
Copy link
Contributor Author

No problem! I'm glad this was useful.

The Koa update was fairly uneventful. The majority of the work was updating the code to conform to the Koa type definitions. When accessing HTTP request headers, for instance, you might get back a string or an array, and so there were some extra checks put in place. Probably the most laborious piece was rewriting pagination support: scimmy-routers mutates the request object to cast the incoming values. I instead rewrote this code to be a function that takes the request object and returns the parsed and cast values on a new object (and used that in all places where pagination params get used). This is all less specific to Koa than it is to typescript (which made the Koa conversion much easier).

The code isn't in production yet due to some challenging product requirements, but once it is I could see about taking the fork and making it available as a reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Development

Successfully merging this pull request may close these issues.

2 participants