Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

feat: add typings for neutrino config and api #1468

Closed
wants to merge 2 commits into from

Conversation

eddyw
Copy link

@eddyw eddyw commented Sep 12, 2019

Related to: #1129 (comment)

Motivation: It's hard to work with Neutrino if there is no code editor intellisense or/and auto-completion. Even though, .neutrinorc.js is a JS file, we could use JSDocs to specify the type of the configuration object and get intellisense:

/**
 * @type {import('neutrino').Configuration}
 */
const config = { ... /* << ---- code editor suggestions work */ }
config.    << ---- code editor suggestions work here too

module.exports = config

PR:
– It adds typings for Neutrino api (class) and configuration
– It adds typings tests for TS
– It adds typings tests for JS (when using JSDocs)

Notes: tsconfig.json file has checkJs and allowJs options set to true, so it works checking the types of JSDocs. Tests for JS typings are not extensive, just as good as they can be.

This PR doesn't introduce any breaking changes.

Copy link
Member

@edmorley edmorley left a comment

Choose a reason for hiding this comment

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

@eddyw thank you for the PR and sorry for not replying sooner.

I'm not very familiar with TypeScript (was on my list of things to learn, before I ended up switching to other languages for work), so will only be able to give a cursory review and will be mostly relying on CI / what others say.

Could you rebase on master and make sure test:types runs on CI? (Perhaps using lerna test:types which can be run from the monorepo root, and will skip any packages that don't define it).

@edmorley edmorley added this to the Neutrino 9 milestone Nov 3, 2019
@edmorley edmorley removed this from the Neutrino 9 milestone Dec 13, 2019
@edmorley
Copy link
Member

Closing for inactivity. Happy to reopen if the PR is updated :-)

@edmorley edmorley closed this Oct 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

2 participants