Skip to content

Instantly share code, notes, and snippets.

@patrickarlt
Created October 18, 2016 23:10
Show Gist options
  • Save patrickarlt/46bdf8bc22cb8b459402542a607d4641 to your computer and use it in GitHub Desktop.
Save patrickarlt/46bdf8bc22cb8b459402542a607d4641 to your computer and use it in GitHub Desktop.
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [ "node_modules/@types/" ],
"types": [ "node", "jasmine", "core-js" ]
}
}
var path = require('path');
module.exports = {
entry: {
root: './src/assets/js-es6/ng/apps/main.ts'
},
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.js', ''],
root: [
path.resolve('./src')
]
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel'
},
{
test: /\.ts$/,
exclude: /(node_modules|bower_components)/,
loaders: [
'ts',
'angular2-router-loader?debug=true'
]
},
{
test: /\.html$/,
exclude: /(node_modules|bower_components)/,
loader: 'html'
},
{
test: /\.json$/,
exclude: /(node_modules|bower_components)/,
loader: 'json'
}
]
},
output: {
path: path.join(__dirname, 'build', 'assets', 'js'),
sourceMapFilename: '[name].js.map',
filename: '[name].js',
chunkFilename: '[id].chunk.js',
publicPath: 'http://localhost:8080'
}
};
@kasir-barati
Copy link

Hello. Did you know how can I have multiple .d.ts file in my project globally?
Assume I have this tsconfig.json:

{
    "compilerOptions": {
        "types": [
            "./node_modules/@types",
            "global.d.ts",
            "**/*.d.ts"
        ]
    }
}

And now I have this src/packages/logger/module.d.ts file:

declare global {
    namespace NodeJS {
        interface ProcessEnv {
            LOGGER_LEVEL: WinstonDefaultLogLevels;
            LOGGER_MAX_SIZE: string;
            LOGGER_MAX_FILES: string;
            IS_ROTATE_LOGGER_FILES_ACTIVATED: boolean;
            LOGGER_NAME?: string;
        }
    }
}

And also the samething for And now I have this src/packages/app/module.d.ts file:

import { WinstonDefaultLogLevels } from './src/packages/logger/logger.type';
import { NodeEnv } from './src/shared/types/web.type';

declare global {
    namespace NodeJS {
        interface ProcessEnv {
            NODE_ENV: NodeEnv;
            DATABASE_URL: string;
            APP_PORT: string;
            APP_EXPOSED_PORT: string;
            APP_HOST: string;
            SA_USERNAME?: string;
            SA_PASSWORD?: string;
            SWAGGER_PATH?: string;
        }
    }
}

How can I do it?
Any help appreciated.

@kasir-barati
Copy link

Resolved. I commented the types option in tsconfig.json and also remove the declare global { ... from the src/packages/logger/module.d.ts file. And everything just work as it should. :)
For more info read my repository: https://github.com/kasir-barati/you-say

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment