Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont require declaration files after compile #9456

Closed
lasekio opened this issue Jun 30, 2016 · 3 comments
Closed

Dont require declaration files after compile #9456

lasekio opened this issue Jun 30, 2016 · 3 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@lasekio
Copy link

lasekio commented Jun 30, 2016

I use import instead of <reference .. to import my d.ts files. But after I'd compiled this:

import 'tests/interfaces/mocha.d.ts';

I've got:

"use strict";
require('tests/interfaces/mocha.d.ts');

My config file:

{
    "compilerOptions": {
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "module": "commonjs",
        "moduleResolution": "classic",
        "noImplicitAny": false,
        "outDir": "dist",
        "rootDir": ".",
        "sourceMap": true,
        "target": "es5"
    }
}

Can i change this behaviour by config?

@mhegazy
Copy link
Contributor

mhegazy commented Jun 30, 2016

do not put the file extension in the require statement. use the module name. so:

import 'tests/interfaces/mocha';

or if you are using TS 2.0:

import 'tests/interfaces/mocha.js';

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Jun 30, 2016
@lasekio
Copy link
Author

lasekio commented Jun 30, 2016

@mhegazy I use version 1.8.10

import 'tests/interfaces/mocha';

works same.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 30, 2016

Can i change this behavior by config?

no. module names are resource identifiers, they are written in the output the same way they are read. the compiler will not change the import name or extension.

@mhegazy mhegazy closed this as completed Jul 6, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

2 participants