[keycloak-dev] Typescript support for Node.js adapter

Evan Shortiss eshortis at redhat.com
Mon May 13 22:10:44 EDT 2019


It's a developer experience and polish thing IMO. Not critical to runtime,
but massively helpful for development.

Looking at the docs here[1] I can guess at what argument types are, but
have no *real *idea if I guessed them correctly until I get a runtime
failure or some sort of undefined/unexpected behaviour. I'll always favour
fail fast behaviour and typings provide it by vetting my code before
runtime. There also seem to be some functions available (defined in the PR
d.ts file) that are not covered in docs (I may need to look harder?) so a
*d.ts* file would allow you generate some docs for these functions.

If the kc team don't want to support it types can be published in
DefinitelyTyped[2] and maintained by others instead. If it becomes a team
priority they can eventually be moved into the official module.

[1] -
https://www.keycloak.org/docs/latest/securing_apps/index.html#_nodejs_adapter
[2] - https://github.com/DefinitelyTyped/DefinitelyTyped

On Mon, May 13, 2019 at 3:17 PM Bruno Oliveira <bruno at abstractj.org> wrote:

> Thanks Stan, I'm adding Evan so he can provide his thoughts on it.
>
> On 2019-05-10, Stan Silvert wrote:
> > On 5/10/2019 8:15 AM, Bruno Oliveira wrote:
> > > If you ask me, I'm not crazy about the idea of providing Typescript
> > > definitions inside the Node.js adapter. And there's a single request
> > > from the community about it.
> > >
> > > At the same time, it's hard to ignore some numbers. The weekly NPM
> > > downloads for Typescript is almost 5 million[1] and for ts-node[2] is
> > > almost 2 million.
> > >
> > > The goal of that PR is to provide only the Typescript definitions for
> > > the Node.js adapter, so that projects using the adapter can benefit
> from
> > > it.  If we agree to move forward with this, I believe some automated
> way
> > > to generate it, has to be provided.
> > >
> > > Thoughts?
> > Yes, you should provide it.  These days, every serious javascript
> > library is expected to have a definition file.
> >
> > I don't think there would be any way to automate creation of the file
> > unless you write your code in TypeScript.
> > >
> > > [1] - https://www.npmjs.com/package/typescript
> > > [2] - https://www.npmjs.com/package/ts-node
> > >
> > > On 2019-05-10, Stian Thorgersen wrote:
> > >> Is Typescript commonly used in the Node.js community? From what
> > >> I understand it is very popular with client-side js these days.
> > >>
> > >> On Thu, 9 May 2019 at 20:59, Bruno Oliveira <bruno at abstractj.org>
> wrote:
> > >>
> > >>> Good morning, we have this PR opened long time ago
> > >>> https://github.com/keycloak/keycloak-nodejs-connect/pull/123/files.
> > >>> Before review it and probably update it I would like to ask.
> > >>>
> > >>> Is Typescript something that we would like to support in the Node.js
> > >>> adapter? If your answer is yes, why?
> > >>>
> > >>> --
> > >>> - abstractj
> > >>> _______________________________________________
> > >>> keycloak-dev mailing list
> > >>> keycloak-dev at lists.jboss.org
> > >>> https://lists.jboss.org/mailman/listinfo/keycloak-dev
> > >>>
> >
> > _______________________________________________
> > keycloak-dev mailing list
> > keycloak-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/keycloak-dev
>
> --
>
> abstractj
>


-- 

Evan Shortiss

Technical Marketing Manager

Red Hat NA <https://www.redhat.com/>

Los Angeles

evan.shortiss at redhat.com
M: +1-781-354-2834     IM: evanshortiss
<https://www.redhat.com/>


More information about the keycloak-dev mailing list