tsc

TypeScript 2.1.4 breaking changes in webpack ts-loader

╄→尐↘猪︶ㄣ 提交于 2019-12-12 18:03:07
问题 Upgrading from Typescript 2.0.10 to 2.1.4 appears to break something in webpack, webpack-stream, ts-loader, or gulp as it’s no longer respecting my entry point or gulp source glob. It appears to be including all .ts files in my project (including the ones in the /server source folder) rather than just the ts files in /client and app.ts as per the gulp.src and web pack entry point. Is there a different/newer/better way I should be doing this? in gulp file: const serverPath = 'server'; const

“tsc --out … --declaration” is not including custom interfaces

£可爱£侵袭症+ 提交于 2019-12-12 15:25:34
问题 Setup Lets say that we have two files, A.ts and B.d.ts. Now inside A we have: class A implements B{...} Now lets say I want to combine all my typescript files into a singular definition file. The only way I know of how to do this is to create a .js file and then also a resultant .d.ts file. Therefore we do: tsc --out foo.js --declaration B.d.ts A.ts We get foo.js, and foo.d.ts. Now the only issue is that foo.d.ts only contains the definition for A.ts and not for B.d.ts. So to get our

TscToolPath null in Microsoft.TypeScript.targets after installed update 3 of visual studio 2015

邮差的信 提交于 2019-12-12 13:28:28
问题 I get this error in visual studio 2015 after installing update 3. Using TS 2.0. Error Invalid command line switch for "tsc.exe". Value cannot be null. Parameter name: path1 ProjectTest C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets 214 This points to this code so i think TscToolPath is null <VsTsc ToolPath="$(TscToolPath)" ToolExe="$(TscToolExe)" TSConfigFile="%(ConfigFiles.Identity)" YieldDuringToolExecution="$(TscYieldDuringToolExecution)

typescript outDir setting in tsconfig.json not working

久未见 提交于 2019-12-12 09:29:35
问题 I can't seem to get the outDir flag working when used in package.json . Directory structure is pretty simple: tsconfig.json at the root level, together with a src/ directory and a single index.ts file plus other directories representing other modules. When running the tsc command on the index file, it creates a new one beside it instead of in the build directory. What am I doing wrong? My tsconfig: { "compilerOptions": { "outDir": "build" } } My npm build script: "build": "tsc src/index.ts" I

How can i compile a file containing different libraries (e.g. jquery, jquery-ui, other 3rd party libs) with typescript

笑着哭i 提交于 2019-12-12 06:59:36
问题 I am working on a project that contains multiple libraries (Jquery, jq-ui, fileupload plugins and some other 3rd party plugins) i am converting my project to typescript but in order to work with those libraries I need a .d.ts file to include in my project but when i compile my plugins.ts (just rename from .js to .ts) it give me a bunch of errors and generate a .js file but no .d.ts file and i cannot compile my other files as i need to include a reference of my plugin file is there any kind of

Typescript cannot find module './lib'

雨燕双飞 提交于 2019-12-11 17:35:16
问题 I am trying to use winston-aws-cloudwatch library in my server side app in Typescript. I have a SSCCE setup on GitHub in case you want to reproduce the issue. Here is the detail. index.ts import logger from './logger'; logger.info(`🚀🚀🚀 logger is up !!`); logger.ts import winston from 'winston'; import CloudWatchTransport from 'winston-aws-cloudwatch'; const logger = winston.createLogger(); logger.add(new CloudWatchTransport({logGroupName:'my-api', logStreamName: 'lstream'})); logger.level =

error TS6059: File is not under 'rootDir' .. 'rootDir' is expected to contain all source files

北城以北 提交于 2019-12-11 16:38:25
问题 I am getting this fairly non-sensical tsc transpilation error: error TS6059: File '/Users/alex/codes/interos/teros-cli/src/logging.ts' is not under 'rootDir' '/Users/alex/codes/teros/notifier-server/src'. 'rootDir' is expected to contain all source files. my PWD is /Users/alex/codes/teros/notifier-server and the tsconfig.json file for /Users/alex/codes/teros/notifier-server/tsconfig.json is: { "compilerOptions": { "outDir": "dist", "allowJs": false, "pretty": true, "resolveJsonModule": true,

Use cpx and typescript to watch and serve file changes

 ̄綄美尐妖づ 提交于 2019-12-11 14:38:05
问题 I am using cpx to copy .yml files and typescript to compile .ts files. All of this is then served with an npm script using node as follows: start: "tsc && cpx \"src/**/*.yml\" dist/src && node ./dist/server.js This functions without a problem on the production server. The problem arises when I try to run the setup in watch mode during development using tsc-watch as follows: "start:watch": "cpx \"src/**/*.yml\" dist/src --watch && tsc-watch --onSuccess \"node ./dist/server.js\" --onFailure \

tsconfig.js exclude property not working when import modules is used

删除回忆录丶 提交于 2019-12-11 08:17:16
问题 I am going nuts currently why my typescript compilation (tsc) is always trying to compile node_modules files even when I've specified to exclude this folder. [ tl;dr; : it's because I have imports but I don't know how to exclude imports from compilation ] I'm using Visual Studio Code, but have the same issue when running tsc directly from commandline My project structure is a typical one : . | --node_modules\.. | --src\.. | --typings In my root I have a tsconfig.json with following content: {

Resolving paths in TypeScript outDir

自闭症网瘾萝莉.ら 提交于 2019-12-11 06:10:02
问题 I'm writing a UI page object model testing project in TypeScript and I'm trying my best to avoid hideous nested imports. I found the paths object for the .tsconfig file that fixes the issue in .ts files, but, because I compile into an outDir , my compiled .js files cannot resolve the module path. I develop in a model directory and compile into a src directory. I've set up my .tsconfig file as follows { "compilerOptions": { "target": "es6", "module": "commonjs", "moduleResolution": "node",