frankwallis / plugin-typescript

TypeScript loader for SystemJS
MIT License
248 stars 47 forks source link

Curious search for .d.ts file which should never be created when updating 5.2.4 => 5.2.7 #171

Closed DorianGrey closed 8 years ago

DorianGrey commented 8 years ago

Hi,

I've recently tried to update plugin-typescript in our project (https://github.com/flaviait/ng2-jspm-template) from 5.2.4 to 5.2.7. This caused a rather curious error:

err  Error on fetch for src/app/app.component.d.ts!github:frankwallis/plugin-typescript@5.2.7/plugin.js at file:///home/linne/Projects/ng2-jspm-template/src/app/app.component.d.ts!file:///home/linne/Projects/ng2-jspm-template/jspm_packages/github/frankwallis/plugin-typescript@5.2.7/plugin.js
  Loading src/app/app.component.ts
  Error: ENOENT: no such file or directory, open '/home/linne/Projects/ng2-jspm-template/src/app/app.component.d.ts'
    at Error (native)

Any idea why the plugin is searching for a definition file for an existing source file?

/cc @svi3c

frankwallis commented 8 years ago

Hi, this looks to be happening because of the typings configuration for .scss files:

        '*.scss': {
          'loader': 'scss',
          'typings': true
        }

this commit relaxed the check so that the plugin will try and resolve typings for all file extensions. In this case it is looking for the typings for app.component.scss but they do not exist.

DorianGrey commented 8 years ago

Thanks for the investigation. Unfortunately, there is a type definition that should match app.component.scss - a wildcard definition in src/customTypings.d.ts:

declare module "*.scss" {
  let __scss__: string;
  export default __scss__;
}

This file is listed in the files section of our tsconfig.json. So this error is a little bit ... confusing.

However, removing the explicit typings configuration entry for .scss files get this working again.