From a790304116a1ef562b2a76ad95f1a615998c3041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=96=E7=8C=A9?= Date: Wed, 1 Aug 2018 14:53:35 +0800 Subject: [PATCH] fix: fixed ts-node ignore files (#105) --- lib/ts-helper.js | 1 + test/fixtures/example-ts/app/controller/home.ts | 4 +++- test/fixtures/example-ts/typings/global.d.ts | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/example-ts/typings/global.d.ts diff --git a/lib/ts-helper.js b/lib/ts-helper.js index e43dfa76..cb435ad3 100644 --- a/lib/ts-helper.js +++ b/lib/ts-helper.js @@ -2,4 +2,5 @@ require('ts-node').register({ typeCheck: true, + files: true, }); diff --git a/test/fixtures/example-ts/app/controller/home.ts b/test/fixtures/example-ts/app/controller/home.ts index a860bc79..58053862 100644 --- a/test/fixtures/example-ts/app/controller/home.ts +++ b/test/fixtures/example-ts/app/controller/home.ts @@ -4,6 +4,8 @@ import { Controller } from 'egg'; export default class HomeController extends Controller { public async index() { - this.ctx.body = 'hi, egg'; + const obj: PlainObject = {}; + obj.text = 'hi, egg'; + this.ctx.body = obj.text; } } diff --git a/test/fixtures/example-ts/typings/global.d.ts b/test/fixtures/example-ts/typings/global.d.ts new file mode 100644 index 00000000..10aa1e9b --- /dev/null +++ b/test/fixtures/example-ts/typings/global.d.ts @@ -0,0 +1,3 @@ +interface PlainObject extends Object { + [key: string]: any; +}