Skip to content
This repository has been archived by the owner on Sep 11, 2019. It is now read-only.

Migrate code to TypeScript #80

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

corycook
Copy link

This is my initial attempt to convert gramps to TypeScript.

Some notes:

TypeScript interfaces don't need to be implemented so the following is valid:

interface MyInterface {
  name: string;
}

function test(input: MyInterface) {
  console.log(input.name);
}

test({ name: 'testing' });

Interface files are not output during compilation and there is no executable code in files that just export interfaces so I'm using a naming convention to differentiate interface files to exclude them from coverage reporting. If we ever need to make a file that fits this naming convention (interface files are prefixed with a capital 'I') and is not an interface file then we may need to change how these files are excluded. They need to be excluded since coverage is reported as 0% statement coverage.

This implementation uses some loose definitions to fit the existing code. Implicit "any" type is not allowed; however, there is a lot of use of explicit any that could be more strictly defined. Most of the inputs and outputs are defined via interfaces to improve usability.

package.json Outdated
"lint": "eslint src/**/*.js",
"test": "npm run lint --silent && npm run test:unit --silent",
"test:unit": "cross-env NODE_ENV=test LOG4JS_LEVEL='OFF' jest --coverage",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"dependencies": {
"chalk": "^2.1.0",
"express": "^4.16.2",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does express need to be a dependency? I believe it should only be a devDependency.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants