Exporting Angular 5/Typescript classes/interfaces under a custom namespace

I have a TypeScript library that was created using Angular 5 compiler. Inside this library, I have defined some classes and interfaces within a namespace.

export namespace A{
    export class C1 {
    }
    export interface I1{
    }
}

After compiling the code with the Angular 5 ngc compiler, it generates a filename.metadata.json file which contains a value of [null].

However, when I try to use this library in my Angular 5 application, it throws an error due to the null .metadata.json file.

TypeError: Cannot read property 'version' of null

It's worth noting that this setup worked perfectly fine with Angular 4.3.3. Additionally, when I compile the code using the TypeScript compiler tsc, it does not generate the .metadata.json file at all, resulting in no errors.

Answer №1

The latest release of Angular 5.1.2 includes a fix by the Angular team for an issue in the compiler. With this fix, invalid ".metadata.json" files are no longer emitted. This means that files containing only nested namespaces will not generate ".metadata.json" files anymore.

Source: https://github.com/angular/angular/issues/20479

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for utilizing ng2-dragula and resizing Angular elements efficiently

Currently, I am employing Dragula for drag-and-drop functionality in my tables. Additionally, I am utilizing the angular resizer element plugin for table column resizing. These features are being implemented within Angular2. However, I am facing an issue ...

What steps should I take to resolve the error message "Error: srcmain.ts is not found in the TypeScript compilation?"

I've exhausted all possible solutions on StackOverflow and have even gone as far as uninstalling both Node and Angular three times in the span of three days. I'm completely stumped as to why this issue keeps occurring specifically when using "ng ...

What is the best method for typing a component prop that is compatible with singular use and can also function within loops without disrupting intellisense?

The Scenario Within a heading component, I have defined various types as shown below: // Heading/index.d.ts import { HTMLAttributes } from 'react'; export const HeadingType: { product: 'product'; marketing: 'marketing'; ...

I'm looking to receive the specific data types for express request arguments. How can I

Currently, I am working on incorporating authentication into an express application using passport and typescript. For defining the user model, I have utilized typegoose. Once the login request passes through the passport strategy, a login method is called ...

Tips on accessing the formControl element within a formBuilder array

Is there a way to retrieve the value from mat-autocomplete when using formControlName? It seems that mat-autocomplete doesn't work in this scenario. <mat-form-field> <mat-label>...</mat-label> <input type="text ...

Angular: Array in the template re-renders even if its length remains unchanged

Below is the template of a parent component: <ng-container *ngFor="let set of timeSet; index as i"> <time-shift-input *ngIf="enabled" [ngClass]="{ 'mini-times' : miniTimes, 'field field-last&ap ...

Tips for implementing dynamic typing with Prisma

Encountering the error "this expression is not callable" while using the findUnique method with dynamic models. How can this type error be resolved? export const isFound = async ( model: Prisma.ModelName, id: string | number, idName: string ): Promis ...

Creating an Angular reactive form with checkboxes and initializing a formArray with an existing array

I have a dynamic array of LkBoardTypeList fetched from a server. My goal is to push that array to form an array upon initialization, essentially displaying checkboxes based on the Board's name or ID in the array. I know how to push an empty array in r ...

The ngx-toaster message is showing a delay of about 30-40 seconds before displaying on the browser in Angular 11

Within the App.module file: Include ToastrModule in appModule ToastrModule.forRoot({ timeOut: 3000, preventDuplicates: true, }), Inside a specific component: this.toastr.error("test err"); The error message is taking quite a while to disp ...

Launching Angular Application on Amazon Web Services S3 or EC2

I'm currently looking into deploying an Angular application on AWS and I've come across two potential methods: Using an S3 Bucket Deploying on an EC2 instance with nginx Which of these options is considered the best approach and why? The appli ...

Step-by-step guide on integrating moment.js as a pipeline in an Angular2 application

I am currently working on incorporating the moment.js library into my Angular2 project to convert a UTC time to a specific time zone, like Europe/London, using moment and [moment timezone]. More information can be found here. After installing moment.js in ...

What is the best way to handle code versioning using Django, Angular2, and Webpack?

Currently, I am utilizing Django in conjunction with Angular 2 and Webpack. Within Django, I have set up a URL to display my application at http://example.com/user/beta. Initially, my index.html file is rendered, which contains my Angular 2 components. Wit ...

Angular 4 or React: Unveiling the Performance Battle between Theory and Reality

While it may seem like the same old comparison between x vs y, what is faster?, I believe my version offers a unique perspective. React and Angular are as different as GTK and Qt (or even more), making comparisons between them futile - one is a versatile f ...

I encountered a SyntaxError while parsing JSON due to an absence of a number after a minus sign at position 1

I am trying to use the replicate model visoar/product-photo:edf42659dae0da88a26dba4912e7e4bb6c2fba25b1e1c6a5464cf220e467bce0, but when I provide it with an image and a prompt like on this page.tsx: "use client" import { LandingNavBar } from &apo ...

Implementing a global provider in Ionic 3

I have integrated a provider in my app that needs to stay active at all times while the application is running to monitor the network connection status. Following this guide, I included the class in my app.module.ts file to ensure it functions as a global ...

Error encountered with structured array of objects in React Typescript

What is the reason for typescript warning me about this specific line of code? <TimeSlots hours={[{ dayIndex: 1, day: 'monday', }]}/> Can you please explain how I can define a type in JSX? ...

Angular HttpInterceptor Unit Test: toHaveBeenCalledWith method shows no sign of being called

I have been working on unit testing an error-handling interceptor and encountered an issue with the toHaveBeenCalledWith function. It keeps giving a "but it was never called" message in the console. Can anyone shed some light on why this might be happening ...

How come my button is initiating automatically instead of manually?

Working on developing an API using Angular 2 with the Janus media server has brought up an issue regarding the start button. When running Janus, the button initiates automatically instead of manually. The following function was implemented for this purpos ...

Achieving the functionality of making only one list item in the navbar bolded upon being clicked using React and Typescript logic

Currently, in my navigation bar, I am attempting to make only the active or clicked list item appear bold when clicked. At the moment, I can successfully achieve this effect; however, when I click on other list items, they also become bolded, while the ori ...

Error: SQLSTATE[23000] encountered in a non-empty column with [Angular 5 & NodeJS] integration

Currently, I am utilizing Angular 5 along with a NodeJS API powered by express. The issue I'm facing involves saving form data to my "training" table and encountering the following error: "code":"ER_BAD_NULL_ERROR","errno":1048,"sqlMessage":"The ...