Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Use type imports #253

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

thewilkybarkid
Copy link
Contributor

TypeScript 3.8 introduced type-only imports.

Not sure if this is all the cases, and not sure what should happen with ordering (keep the same order or separate them?).

@thewilkybarkid thewilkybarkid added the 📦 Refactor A code change that neither fixes a bug nor adds a feature label Feb 21, 2020
import Router, { RouterContext } from '@koa/router';
import type Router from '@koa/router';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you’ve used Flow before, the syntax is fairly similar. One difference is that we’ve added a few restrictions to avoid code that might appear ambiguous.

This is a bit annoying.

@@ -4,7 +4,8 @@
"module": "commonjs",
"outDir": "build",
"strict": true,
"esModuleInterop": true
"esModuleInterop": true,
"importsNotUsedAsValues": "error"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better if the linter could fix these, refs typescript-eslint/typescript-eslint#1436 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
📦 Refactor A code change that neither fixes a bug nor adds a feature
Projects
None yet
1 participant