diff --git a/.travis.yml b/.travis.yml index f1c48e457..461c7da5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,4 +17,5 @@ env: - TYPESCRIPT=typescript@2.1.5 - TYPESCRIPT=typescript@2.2.1 - TYPESCRIPT=typescript@2.3.1 + - TYPESCRIPT=typescript@2.4.1 # - TYPESCRIPT=typescript@next diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dc076ef5..638641b94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## v2.2.1 - NOT RELEASED YET - [Report errors in JS(X) files when CheckJS is enabled](https://github.com/TypeStrong/ts-loader/pull/564) - thanks @schmuli! +- [Cater for change to @types acquisition strategy in TypeScript 2.4.1](https://github.com/TypeStrong/ts-loader/pull/566) - thanks @johnnyreilly ## v2.2.0 diff --git a/appveyor.yml b/appveyor.yml index 6a6f9111a..88a47eb77 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,7 @@ environment: - TYPESCRIPT: typescript@2.1.5 - TYPESCRIPT: typescript@2.2.1 - TYPESCRIPT: typescript@2.3.1 + - TYPESCRIPT: typescript@2.4.1 # - TYPESCRIPT: typescript@next install: - ps: Install-Product node $env:nodejs_version diff --git a/src/servicesHost.ts b/src/servicesHost.ts index d59408d68..1bc44554c 100644 --- a/src/servicesHost.ts +++ b/src/servicesHost.ts @@ -63,6 +63,12 @@ function makeServicesHost( * For @types expansion, these two functions are needed. */ directoryExists: compiler.sys ? ( compiler.sys).directoryExists : undefined, + + // The following three methods are necessary for @types resolution from TS 2.4.1 onwards see: https://github.com/Microsoft/TypeScript/issues/16772 + fileExists: moduleResolutionHost.fileExists, + readFile: moduleResolutionHost.readFile, + readDirectory: compiler.sys ? ( compiler.sys).readDirectory : undefined, + getCurrentDirectory: () => process.cwd(), getCompilationSettings: () => compilerOptions,