Categories
Mastering Development

You may need an appropriate loader to handle this file type, currently no loaders are configured to process file

I just created a project using create-react-app (in javascript). In that, I am linking one of my other repository like this { "name": "hh-frontend-example", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", "hh-stylesheet": "file:../hh-stylesheet", "react": "^16.13.1", "react-dom": "^16.13.1", "react-scripts": "3.4.1" }, Here notice this line: "hh-stylesheet": "file:../hh-stylesheet", Now, When I start […]

Categories
Mastering Development

Property ‘toBeInTheDocument’ does not exist on type ‘Matchers

Trying to setup testing for a components library. I’ve tried many example and all similar threads on this with no luck. My setupTests.ts file is correctly being loaded (proven with a console.log), and the library seems to be available as if I add import { toBeInTheDocument } from ‘@testing-library/jest-dom/matchers’ and log toBeInTheDocument it is present. […]

Categories
Mastering Development

Issue trying to setup jest: application code compiles fine but test code doesn’t

I am trying to migrate to jest and I am facing typescript issues… I have 3 tsconfig files: tsconfig.json (base config) tsconfig.lib.json (application config) tsconfig.jest-spec.json (jest-dedicated test config) Please note that there are also karma/jasmine dedicated tsconfig files but those are irrelevant. I have separated the jest tests from the karma ones. tsconfig.json { "compileOnSave": […]

Categories
Mastering Development

Unexpected token “export” using babel in docker container with docker-compose and typescript monorepo

I have been struggling with the following issue over the last couple days and can’t seem to track it down. I have a typescript monorepo with a shared package that I am trying to develop in docker using docker-compose. I can run them all directly from my local machine with yarn and everything boots up […]

Categories
Mastering Development

Cannot read property ‘fromJSON’ of undefined while testing in Jest

while running jest i get the following error.I dont know why am i getting this error. TypeError: Cannot read property ‘fromJSON’ of undefined at Object. (node_modules/@grpc/proto-loader/node_modules/protobufjs/ext/descriptor/index.js:3:66) at Object. (node_modules/@grpc/proto-loader/build/src/index.js:23:20) Below is the tsconfig.json { “compilerOptions”: { “target”: “esnext”, “module”: “commonjs”, “outDir”: “dist”, “sourceMap”: true, “moduleResolution”: “node”, “declaration”: true, “experimentalDecorators”: true, “allowSyntheticDefaultImports”: true, /* Allow default […]

Categories
Mastering Development

Angular library on ng build files are not included on dist folder

I have a library create with angular 9 with a project structure like below When I build the library ng build falcon-core the view-models files are not included in the dist folder I didn’t find any settings related to the files structure in the tsconfig.lib.ts { “extends”: “../../tsconfig.json”, “compilerOptions”: { “outDir”: “../../out-tsc/lib”, “target”: “es2015”, “declaration”: […]

Categories
Development

tsconfig “paths” are compiled and included by tsc? How can you stop this?

Imagine the following project structure /src index.ts a.ts /external external.ts When using the following tsconfig.json: { “compilerOptions”: { “outDir”: “dist”, “declarationDir”: “dist”, “declaration”: true, “baseUrl”: “./src”, “paths”: { “@external/*”: “../external/*” } }, “exclude”: [ “dist” ] } The output will contain the external package /dist /src a.d.ts a.js index.d.ts index.js /external external.d.ts external.js When what […]

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

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
Development

Starting nestjs in production mode

I am using akveo backend bundle that I bought, and while everything seems to be working fine in development mode starting in production gives me following errors, I am new to nestjs itself. Anyone know what’s going here? node_modules/@nestjs/core/adapters/http-adapter.d.ts:5:31 – error TS2420: Class ‘AbstractHttpAdapter<TServer, TRequest, TResponse>’ incorrectly implements interface ‘HttpServer<TRequest, TResponse>’. Property ‘status’ is missing […]