s-panferov / awesome-typescript-loader

Awesome TypeScript loader for webpack
Other
2.35k stars 179 forks source link

Exporting type causes some silent error ? #381

Open gotenxds opened 7 years ago

gotenxds commented 7 years ago

Hello, I have some weird issue, I have the following file:

import {Node} from './WordGraph/Node';

export type Predicate = (node: Node, char: string, word: string) => boolean; //Problematic line ?

export class Predicates {
    static endsWith(suffix) {
        return (node, char, word) => word.endsWith(suffix);
    }

    static containsAny(strings: string[]): (node: Node, char: string, word: string) => boolean {
        return (node: Node, char: string, word: string) => strings.some(expression => RegExp(expression).test(word));
    }

    static containsAll(strings: string[]): (node: Node, char: string, word: string) => boolean {
        return (node, char, word) => strings.every(expression => RegExp(expression).test(word));
    }
}

Another file imports this file.

import {Predicate} from '../Predicates';

When compiling with the tsc command everything is fine, I get the js and d.ts files. When running awesome-typescript-loader I get no error, but the Node class (being used in that type) is not being compiled nor do I get a d.ts file.

Note that this is fixed after deleting the import {Predicate} from '../Predicates'; line.

This does not output any error to the console, the Node.ts file is just being omitted from the list of compiled files...

This is really weird and again using the typescript compiler directly via the tsc command works.

s-panferov commented 7 years ago

@gotenxds please provide tsconfig.json, webpack.config.json, tsc version, loader version, NodeJS version and operation system info