Categories
Mastering Development

Must I fix all TSLint errors before Angular production build?

I am able to run my Angular v8 app in development mode even there are TSlint TS errors (just showed few at below). However, when I try to build for production, it failed with npm ERR! code ELIFECYCLE npm ERR! errno 2. I have a number of TSlint TS errors, is there a way to […]

Categories
Mastering Development

TypeScript not finding variable declared in type declaration if I import a file

I made a very simple library which contains a .d.ts (source) which has the following structure (I omit the details because the file works fine, it likely is a config issue in my project): // Some helper types and interfaces type TranslationFunction = /* … */; export { TranslationFunction }; Then, I do npm i […]

Categories
Mastering Development

Basic Setup for Typescript Types – Cannot find name ‘angular’

My team is working on an older AngularJS project that we have recently upgraded to .Net Core 3.1 while the project works fine without it we would like to start upgrading our scripts to use TypeScript. None of us have actually used Typescript before and I’m sure we have something very basic messed up in […]

Categories
Development

Report typescript errors as warnings in Visual Studio and don’t fail the build

I want to typecheck existing javascript code. To that end, I have specified the following tsconfig. Running tsc results in a couple of hundred errors, which show up in Visual Studio when I do a build. However those errors now also fail the build. As the code is currently functioning, I want to postpone resolving […]

Categories
Development

unit-tests SyntaxError: Unexpected token {

I get this error: D:\nginx\ibdrweb\webapps\ibdr-document-2\doc-app\sources\forms\dynamic-form\lus\lus.js:1 import { Tools } from “@ShareUtils/tools”; ^ SyntaxError: Unexpected token { at Module._compile (internal/modules/cjs/loader.js:721:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) when i try to execute the following comand: ts-mocha -p doc-app/tests/tsconfig.json doc-app/tests/lus-tests.ts This issue was discussed here https://github.com/Microsoft/TypeScript/issues/26018 and was closed. Attempt to change “module”: “commonjs” at tsconfig.json doesn’t help. A lot of […]

Categories
Angular CSS Development

CSS rules getting omitted after transpiling in Angular 8

I upgraded my application from Angular 2 to Angular 8. I noticed few CSS rules are omitted after transpiling the code. Below is my package.json, tsconfig.json and angular.json package.json { “name”: “xxx-webapp”, “version”: “1.0.0”, “license”: “ISC”, “scripts”: { “ng”: “ng”, “start”: “ng serve”, “build”: “ng build –base-href ./ –deploy-url /Content/Angular/Deploy/”, “test”: “ng test”, “lint”: “ng […]