Skip to content

STCOM-1012: Add initial typescript type declarations#1824

Closed
ncovercash wants to merge 6 commits into
folio-org:masterfrom
ualibweb:stcom-1012-initial
Closed

STCOM-1012: Add initial typescript type declarations#1824
ncovercash wants to merge 6 commits into
folio-org:masterfrom
ualibweb:stcom-1012-initial

Conversation

@ncovercash

Copy link
Copy Markdown
Member

Jira STCOM-1012

This PR adds initial type declarations to this library. These type definitions are effectively meaningless as every export is declared as any (which can match functions, classes, constants, etc, with no type information). However, they provide a starting point for the remainder of STCOM-1012 as types can now be added incrementally.

Please track the Jira ticket to see examples on how these type declarations can be written.

@zburke

zburke commented Jun 13, 2022

Copy link
Copy Markdown
Member

I'm a typescript noob; please bear with me.

Does this change mean we need to keep index.js in sync with types/index.d.ts, i.e. anything we add to the former we need to add to the latter? Should we add comments to that effect in index.js?

@github-actions

Copy link
Copy Markdown

Jest Unit Test Statistics

0 tests  ±0   0 ✔️ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ±0 

Results for commit 3d02f5e. ± Comparison against base commit b20ee0c.

@github-actions

Copy link
Copy Markdown

BigTest Unit Test Statistics

       1 files  ±0         1 suites  ±0   5s ⏱️ ±0s
1 296 tests ±0  1 290 ✔️ ±0  6 💤 ±0  0 ±0 
1 299 runs  ±0  1 293 ✔️ ±0  6 💤 ±0  0 ±0 

Results for commit 3d02f5e. ± Comparison against base commit b20ee0c.

@JohnC-80

Copy link
Copy Markdown
Contributor

Thanks @ncovercash for the initial pass.
Handful of questions around this...
I am typescript-familiar, but I don't have the forward details worked out for this.

I do like the developer experience that TS provides along with its friendliness to developers who are accustomed to working in strongly typed languages... but there are some questions about how things are going to work for this and the maintenance and special cases it could entail.

All that said, this would be a perfect thing to talk about at a stripes-architecture meeting... @ncovercash - we meet every Thursday at 9AM CST - it would be great to talk about it at that meeting with a handful of stripes devs/module devs from elsewhere in the FOLIO ecosystem.

@ncovercash

Copy link
Copy Markdown
Member Author

@JohnC-80 I would love to discuss this at an architecture meeting - is there any particular method for getting something on the agenda for one of these meetings?

And @zburke with this method, yes - there are some tools to automatically generate type definitions, however, they would not be able to do anything more than really just adding "this component exists, good luck on anything more". The separate .d.ts type files are mostly a bridge between pure js modules that the typescript compiler can't infer anything about and a fully TS module. This solution is really just a local version of https://github.com/DefinitelyTyped/DefinitelyTyped, a massive repo full of these kinds of type-only definitions.

With ESCONF-19, this adds TS support for eslint.  The specification of parser here is redundant with the parser specified in the central configuration and overrode the typescript parser on .ts files, therefore, was removed to allow the central configuration to have full authority over parsing.
@ncovercash ncovercash closed this Apr 19, 2023
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.

3 participants