An error in Typescript is indicating that a semicolon is expected. The identifier 'EventNameString' is currently being used as a value, even though it only refers to a type

I've been working on integrating Firebase phone authentication into an older Ionic project and have followed several tutorials. I was able to successfully implement it, but whenever I run ionic serve -l, I encounter the following error:

Interestingly, I discovered that if I comment out one of the lines in app.modules.ts before running ionic serve -l, the errors disappear:

import { AngularFireModule } from "@angular/fire";
import { AngularFireAuth } from "@angular/fire/auth";

Despite trying various solutions suggested online, such as removing the node_modules folder and testing on a different PC, I have yet to resolve this issue.

Error Message:

Typescript Error
';' expected.
gtagName?: string;
/** Sets custom name for `dataLayer` array used by gtag. */
dataLayerName?:string;

Typescript Error
'EventNameString' only refers to a type, but is being used as a value here.
/** Sets custom name for `dataLayer` array used by gtag. */
dataLayerName?:string;

Typescript Error
'never' only refers to a type, but is being used as a value here.
/** Sets custom name for `dataLayer` array used by gtag. */
dataLayerName?:string;

Typescript Error
Cannot find name 'T'.
/** Sets custom name for `dataLayer` array used by gtag. */
dataLayerName?:string;

ionic info :

Ionic Framework: ^3.9.8
Ionic App Scripts: 3.2.4
Angular Core: ^5.2.7
Angular Compiler CLI: ^5.2.7
Node: 12.13.1
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36

app.modules.ts imported dependencies:

import { ErrorHandler, Injectable, Injector, NgModule } from "@angular/core";
import { IonicApp, IonicErrorHandler, IonicModule } from "ionic-angular";
import { BrowserModule } from "@angular/platform-browser";
import { HttpModule } from "@angular/http";
import { HttpClient, HttpClientModule } from "@angular/common/http";

import { Geolocation } from "@ionic-native/geolocation";
import { NativeGeocoder } from "@ionic-native/native-geocoder";

import { MyApp } from "./app.component";
import { TabsPage } from "../pages/tabs/tabs";
import { Loading } from "../pages/loading/loading";
import { Welcome } from "../pages/welcome/welcome";
import { GeoPage } from "../pages/geo/geo";

import { IonicStorageModule } from "@ionic/storage";
import { StatusBar } from "@ionic-native/status-bar";
import { SplashScreen } from "@ionic-native/splash-screen";

import { APIService } from "../services/api_service";
import { CartService } from "../services/cart_service";
import { PushService } from "../services/push_service";
import { UtilService } from "../services/util_service";
import { OrderHistoryService } from "../services/order_history_service";

import { TranslateLoader, TranslateModule } from "@ngx-translate/core";
import { TranslateHttpLoader } from "@ngx-translate/http-loader";
import { RestaurantsPageModule } from "../pages/catalog/restaurants/restaurants.module";
import { GeoPageModule } from "../pages/geo/geo.module";
import { AngularFireModule } from "@angular/fire";
import { AngularFireAuth } from "@angular/fire/auth";
import { firebaseConfig } from "../config";
import { LoginPage } from "../pages/personal/login/login";
import { AuthService } from "../services/auth.service";
import { NgxErrorsModule } from '@ultimate/ngxerrors';

Answer №1

The crucial point to note is that you need to use : instead of = when setting the type to EventNameString. This is why the error 'EventNameString' only refers to a type, but is being used as a value here is occurring.

Regarding other issues, they appear to be mainly syntax errors. As suggested by @nircraft, it would be beneficial to clean out node_modules and its cache, then reinstall everything fresh.

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

"Using Angular Material and the cdk library for drag and drop functionality, you can easily drag and drop content into a TextArea field and have

Upon reviewing these examples: https://jsfiddle.net/qskxzh0e/3/ http://jsfiddle.net/3p1nra6m/1/ and https://stackblitz.com/edit/angular-component-drag https://material.angular.io/cdk/drag-drop/overview Is it feasible to incorporate some Token form L ...

"Displaying the Material Input TextBox in a striking red color when an error occurs during

After referring to the links provided below, I successfully changed the color of a textbox to a darkish grey. Link 1 Link 2 ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline { color: #757575!important; } Although this solved the ...

The ng-select dropdown is experiencing issues on the user interface following an update to the newest versions of Angular 6

Recently, I made the transition of my application from Angular 5 to Angular 6. As part of the update process, I also upgraded ng-select to version 2.4.2, the latest one available on npm/GitHub. However, after the upgrade, the dropdown functionality seems ...

Can you merge two TypeScript objects with identical keys but different values?

These TypeScript objects have identical keys but different properties. My goal is to merge the properties from one object onto the other. interface Stat<T, V> { name: string; description: string; formatValue: (params: { value: V; item: T }) =&g ...

The TypeScript factory class anticipates an intersection

In my code, I have a class factory called pickSomething that generates a specific type based on a key provided from a ClassMap: class A { keya = "a" as const; } class B { keyb = "b" as const; } type ClassMap = { a: A b: B } c ...

Restricted access to unauthorized URL, potentially due to sub-frame navigation restrictions

I'm having trouble opening the clicked URL in the browser from my application. . Do I need to include something else? ...

incorrect indexing in ordered list

I am facing an issue with the ngIf directive in Angular. My objective is to create a notification system that alerts users about any missing fields. Here's a stackblitz example showcasing the problem: https://stackblitz.com/edit/angular-behnqj To re ...

Is there a distinction between Entity[] and array<Entity> in TypeScript?

Everything in the title, for example people: Person[]; people: Array<Person>; What sets them apart? Is there a preferred approach? Note: I couldn't find any guidance on this and I've encountered both in code. ...

Utilize API within an array to enable Ionic to display a PDF in a document viewer

Recently diving into the world of Angular and Ionic, I've come across some interesting API data: [{"ID":"1","Title":"Maritime Safety","File_Name":"9c714531945ee24345f60e2105776e23.pdf","Created":"2018-11-07 17:36:55","Modified":"2018-11-07 17:36:55"} ...

Steps to resolve the Firebase alert stating "you're currently utilizing the development version of Firebase"

Despite following the standard advice I found on various sources to fix this warning in my Vue app, it still persists. This is how I am importing Firebase: import firebase from 'firebase/app'; import 'firebase/app'; import 'fireba ...

Leveraging ES6 Symbols in Typescript applications

Attempting to execute the following simple line of code: let INJECTION_KEY = Symbol.for('injection') However, I consistently encounter the error: Cannot find name 'Symbol'. Since I am new to TypeScript, I am unsure if there is somet ...

Tips for ensuring only one property is present in a Typescript interface

Consider the React component interface below: export interface MyInterface { name: string; isEasy?: boolean; isMedium?: boolean; isHard?: boolean; } This component must accept only one property from isEasy, isMedium, or isHard For example: <M ...

The parameter in the Typescript function is not compatible with the generic type

What causes func1 to behave as expected while func2 results in an error? type AnyObj = Record<string, any>; type Data = { a: number; b: string }; type DataFunction = (arg: AnyObj) => any; const func1: DataFunction = () => {}; const arg1: Data ...

Gatsby website failing to create slugs as anticipated

While trying to follow the Gatsby tutorial, I ran into an issue with generating slugs for MDX files in a subdirectory of src/pages. For instance, if I have a file like src/pages/projects/devmarks/index.md, the expected slug according to the tutorial should ...

Include data types when destructuring arrays within a loop

Is it possible to use type annotations in for...of loops in TypeScript? For example, like this for array destructuring: for(let [id, value]: [string, number] of Object.entries(some_object)) { } Or perhaps like this for object destructuring: for(let {a, b} ...

multiple event listeners combined into a single function

I'm looking to streamline my button handling in JavaScript by creating just one function that can handle all the buttons on my page. Each button will trigger a different action, so I need a way to differentiate between them. I thought of using one eve ...

How do I properly utilize ngIf in Angular2 to display text exclusively when there is no data retrieved from the server?

After retrieving data from the server using ngFor to display it as a search feature, I want to show a message saying 'There's no result' when there are no search results. How can I achieve this? I have attempted the following approach, but ...

Having difficulty deploying a Dockerized production build of an Angular 17 website

Attempting to deploy a website built with Angular 17 (node 18) using Docker and Docker Compose Below is the contents of the Docker file: FROM node:18-alpine as build WORKDIR /app RUN npm i -g @angular/cli COPY package*.json ./ RUN npm ci COPY . ./ RUN ng ...

Using parameters and data type in Typescript

When I remove <IFirst extends {}, ISecond extends {}> from the declaration of this function, the compiler generates an error. Isn't the return value supposed to be the type after the double dot? What does <IFirst extends {}, ISecond extends { ...

Angular 2 - Oops! The "app-root" selector isn't finding any elements to match

Currently diving into Angular 2 with no prior experience in Angular. I came across this tutorial: . After implementing a new component called "app-people-list" and making the necessary update in index.html, I encountered the following exception. Can anyon ...