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

Migrate code to TypeScript - #80

Open
corycook wants to merge 6 commits into
gramps-graphql:masterfrom
corycook:typescript
Open

Migrate code to TypeScript#80
corycook wants to merge 6 commits into
gramps-graphql:masterfrom
corycook:typescript

Conversation

@corycook

Copy link
Copy Markdown

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.

Comment thread package.json Outdated
},
"dependencies": {
"chalk": "^2.1.0",
"express": "^4.16.2",

Copy link
Copy Markdown
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