Skip to content

Add type-check and type-emit steps for type annotation code to the current js code #199

@mrchrisadams

Description

@mrchrisadams

Earlier this week, @sfishel18 proposed the following as a way to improve support for typescript style annotations, while keeping the code accessible to people who aren't familiar with typescript:

what i would propose is:

  1. as much as possible, leave the source code exactly as-is. the files continue to be .js and jsdoc comments are used to declare types. introducing .d.ts files is a last resort for very complex types.
  2. add a "type check" step to the CI process that checks to make sure the code itself matches the types that are declared
  3. add a "type emit" step to the npm publish process that generates a full set of .d.ts files from the declared types and includes that in the published artifacts

Source: Introduce just enough typescript · Issue #77 · thegreenwebfoundation/co2.js by @github

This sounds good, and this issue is exists as a place to link future PRs that implement the various steps outlined above.

I'm going to be on annual leave for a few weeks, and there are a few other demands on @fershad's time as a maintainer.

@sfishel18 - if you're able to lead on this one, we'd be grateful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions