Visual Studio 2017, JavaScript intellisense inconsistencies

JS files are for javascript and are not transpiled using the typescript compiler. If you are using typescript then keep all your typescript in ts files. Also, you shouldn’t put typescript inside your cshtml files because typescript is not javascript. You need to use the typescript compiler to transpile your typescript into javascript which you … Read more

Typescript paths not resolving when running jest?

I wanted to resolve modules paths starting with ~/ to my <baseUrl>/<moduleName>. Thank to OJ Kwon link I solved it with (give him point). tsconfig.json see module-resolution path-mapping doc { “compilerOptions”: { “baseUrl”: “src”, “paths”: { “~/*”: [“*”] } }, } jest config Then we need to tell jest to resolve the paths too. It’s … Read more

Best practice to setup tsconfig “files” vs “include”?

There are two examples of tsconfig.json presented on the official website of TypeScript,—one with “files” property, another one with “include” and “exclude” properties specified: Using the “files” property { “compilerOptions”: { // irrelevant }, “files”: [ “core.ts”, “sys.ts”, “types.ts”, “scanner.ts”, “parser.ts”, “utilities.ts”, “binder.ts”, “checker.ts”, “emitter.ts”, “program.ts”, “commandLineParser.ts”, “tsc.ts”, “diagnosticInformationMap.generated.ts” ] } Using the “include” and … Read more

Typescript noEmit use case

It’s used when tsc is used only for type checking, not for compilation. That’s the case when some other tool (like Webpack, Parcel or Rollup) is responsible for compiling your code. If you are interested in running your code in an interactive mode, look into ts-node or ts-node-dev.

Visual Studio Code can’t resolve angular’s tsconfig paths

I figured it out, even if I’m keep thinking that is all absurd… VsCode automatically looks for a tsconfig.json file and it doesn’t care about tsconfig.app.json, so paths needs to be specified in tsconfig.json. At the same time, the angular-cli scaffolding specify a baseUrl parameter in tsconfig.app.json which overrides the upper one. The solution is … Read more

How to get tsc to Resolve Absolute Paths when Importing Modules using baseUrl?

The answer comes from @DenisPshenov’s comment in one of the answers. It’s buried, so I’ll provide it here… Tell Node where the base url is with NODE_PATH environment variable so that it can resolve absolute paths: Linux / macOS NODE_PATH=dist/ node ./dist/index.js Windows Powershell $env:NODE_PATH=”dist/” node ./dist/index.js

Why does Vite create two TypeScript config files: tsconfig.json and tsconfig.node.json?

You need two different TS configs because the project is using two different environments in which the TypeScript code is executed: Your app (src folder) is targeting (will be running) inside the browser Vite itself including its config is running on your computer inside Node, which is totally different environment (compared with browser) with different … Read more

What is the purpose of tsconfig.json?

The tsconfig.json file corresponds to the configuration of the TypeScript compiler (tsc). These links could give you details about these attributes: http://www.typescriptlang.org/docs/handbook/tsconfig-json.html http://json.schemastore.org/tsconfig https://angular.io/docs/ts/latest/guide/typescript-configuration.html#!#tsconfig Here are some hints: target: the language used for the compiled output module: the module manager used in the compiled output. system is for SystemJS, commonjs for CommonJS. moduleResolution: the strategy … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)