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
Development

Building angular library at ng serve

I am struggling with my angular library development. First of all, I am building an angular 8 library (curent cli version 9) and I want to live see my library code changes while I am serving the demo app in which I am using this library. Current behavior: When I am making changes on library […]

Categories
Development

Why is this React Typescript app throwing errors?

I just created a new React app using npx create-react-app my-app –template typescript and it was working fine until I changed my component to from a stateless one to a stateful one. The error: JSX element type ‘App’ is not a constructor function for JSX elements. TS2605 3 | import App from “./App”; 4 | […]

Categories
Development

How to stop TypeScript error ‘Type A has no properties in common with Type B’ when Type B “extends” Type A in some way

(edited Title to make more general) I’m working in a codebase which uses React class components and Typescript everywhere, and I’m trying to implement react-dropzone (a lightweight, simple but effective file-drop component) using the class-based method. The Hooks implementation is cleaner and simpler but I’d prefer to avoid so as to preserve the paradigm maintained […]

Categories
Development

ng build cannot find module

I am trying to locally test 3 node modules by updating the locations they are being pulled from in their package.json files. The modules are sdk, ng-widget-lib, and frontend. ng-widget-lib depends on sdk and frontend depends on ng-widget-lib. I build sdk locally with babel. I’m running verdaccio as a local npm registry. I update ng-widget/package.json […]

Categories
Development

“An accessor cannot be declared in an ambient context.” in a custom library

I have a webpack, typescript project (A) which emits a small library. The library is used in an angular 8 project (B). In project A I declare a class like: export class Foo { private foo: string; constructor(foo: string) { this.foo = foo; } } export class Bar extends Foo { private bla: string; constructor(foo: […]

Categories
Development

Angular CLI remove arrow functions?

I am trying to get my code running on IE11, however, I am having issues with arrow functions. I cannot figure out how to remove them from the build and replace them with function() {}. It looks like they were removed from my main.js, but in the vendor.js file, the arrow functions still persist. How […]

Categories
Development

Running an Angular 8 app on Internet Explorer 10, 11

Hello I am having a lot of trouble getting my Angular 8 app to show on Internet Explorer 10 and 11. Currently it just loads a blank white page with an empty component. I have followed giudes online and stackoverflow answers like this: How do I support Internet Explorer in an Angular 8 application? But […]

Categories
Development

Ionic Not Compiling Until Recompiled 3 Times

I have created an ionic app and it has stopped compiling successfully first time. First Time i compile it I get an error : “localhost/:1 Refused to load the image ‘http://localhost:8100/favicon.ico‘ because it violates the following Content Security Policy directive: “default-src ‘none’”. Note that ‘img-src’ was not explicitly set, so ‘default-src’ is used as a […]