thinkjs / thinkjs/thinkjs

typescript 编译时没有类型检测

Open
#1,079 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

typescript
Dominant language
JavaScript
Stars
5.3k
Forks
614
PR merge metrics
No merged PRs in 30d

Description

DESC

typescript 编译时没有类型检测

ENV

OS Platform:
win7, centos

Node.js Version:
8.9.1
ThinkJS Version:
think-cli 2.2.1

code
创建命令
thinkjs new xxx typescript

##js代码,controller/index.ts

import Base from './base.js';
export default class extends Base {
    indexAction() {
        let a: number = 'a';
        return this.display();
    }
}
编译
[2018-02-01T10:50:19.740] [17192] [INFO] - transpile file controller\index.ts success
[2018-02-01T10:50:21.201] [17192] [INFO] - transpile file controller\index.ts success
tsc编译
tsc src\controller\index.ts
src/controller/index.ts(4,13): error TS2322: Type '"a"' is not assignable to type 'number'.
src/controller/index.ts(5,21): error TS2339: Property 'display' does not exist on type 'default'.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TypeScript project created by thinkjs new xxx typescript and the transpilation path exercised on controller/index.ts. Compare its compiler configuration and diagnostics with tsc src\\controller\\index.ts, then verify that an invalid assignment produces a compile-time error instead of a success message.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.