The outcome of TypeScript is ES5 JavaScript code

How can I configure TypeScript to output classes, consts, lets, etc., instead of converting everything to vars and functions? My TypeScript version is 2.4.1.

Below is my current tsconfig file:

{
  "compilerOptions": {
    /* Basic Options */
    "target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
    "module": "es2015", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
    "moduleResolution": "node",
    "strict": false, /* Enable all strict type-checking options. */
    "lib": [
      "es2015",
      "dom",
      "es2016",
      "es2017"
    ],
    "alwaysStrict": true
  }
}

Answer №1

To make use of the tsconfig.json file, you must call upon tsc without specifying any input files as parameters.

According to the documentation:

If input files are declared on the command line, the tsconfig.json settings will not be applied.

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

When implementing Swiper in TypeScript, an error is encountered: TypeError - Attempting to invoke the Swiper class constructor without using the 'new' keyword

I am facing an issue for which I couldn't find a solution, so I'm attempting to solve it myself for the first time. I am using TypeScript and Next.js, but unfortunately, Swiper does not offer direct support for Next.js and TS. Below is the TypeS ...

Leveraging mobile interactivity in Angular2

Seeking assistance with implementing swipe events on mobile devices for Angular 2. I came across a mention of using Hammer.js for mobile event handling in this Github issue. Encountering an error when trying to bind the swipe event: EXCEPTION: Hammer.j ...

The sanitizer variable becomes null when accessed outside of the NgOnInit function in Angular using TypeScript

At first, I added DomSanitizer to the component: import { DomSanitizer, SafeResourceUrl} from '@angular/platform-browser'; Next, a class was created and included in the constructor: export class BlocklyComponent implements OnInit { primar ...

Angular2 Navigation: Redirecting to a dynamically constructed route

To start, I need to automatically redirect to today's date as the default. Below is the routing configuration I currently have set up: import { CALENDAR_ROUTE } from './_methods/utils'; export const appRoutes: Routes = [ { path: Cal ...

Neglecting the inclusion of a property when verifying for empty properties

In the code snippet below, I have implemented a method to check for empty properties and return true if any property is empty. However, I am looking for a way to exclude certain properties from this check. Specifically, I do not want to include generalReal ...

Encountering a problem with creating a reusable Vue 3 component "vue-tel-input" using Vite, Composition API, and TypeScript

I recently came across the NPM package, vue-tel-input, and decided to create a separate component for it in my project. Here's how I structured it: components/NPMPackages/VueTelInput/Index.vue <script setup lang="ts"> import { VueTelI ...

Next.js React Server Components Problem - "ReactServerComponentsIssue"

Currently grappling with an issue while implementing React Server Components in my Next.js project. The specific error message I'm facing is as follows: Failed to compile ./src\app\components\projects\slider.js ReactServerComponent ...

When utilizing Rx.Observable with the pausable feature, the subscribe function is not executed

Note: In my current project, I am utilizing TypeScript along with RxJS version 2.5.3. My objective is to track idle click times on a screen for a duration of 5 seconds. var noClickStream = Rx.Observable.fromEvent<MouseEvent>($window.document, &apos ...

Preventing users from entering negative values in an input type=number by implementing Angular FormControl Validators

Is there a way to prevent users from decrementing the value of an input field with type=number to a negative value? I am aware that we can use min=0 in the HTML input element, but I'm looking for another method using Angular FormControl Validators. S ...

Typescript: Firebase App type does not include delete, installations, name, or options properties

Exploring the realm of Typescript and its compatibility with Firebase has been a recent endeavor of mine. I've created a FirebaseProvider that requires a Firebase app to be configured in the following manner: import firebase from "firebase/app&qu ...

Issue encountered with asynchronous waiting while invoking a function

var value = await this.upload(); if (value == true) { // Update item properties this.item.photos = this.uploaded; this.item.price = null; this.item.qty = null; // Add item to data service this.dataSrv.addItem(this.item) .then(() => { ...

Is there a way to trigger the click event in the week view of an Angular 2+ calendar?

https://i.sstatic.net/Vx2x8.png HTML Templates <mwl-calendar-week-view [viewDate]="viewDate" [refresh]="refresh" (click)="weekDayClick($event)"> </mwl-calendar-week-view> In the component file weekDayCl ...

Angular UI failing to refresh despite Observable subscription activation

I'm facing an issue with my Angular page where the UI is not updating when the observable parameter from a service changes. I've experimented with storing the observable result in a flat value and toggling a boolean to update the UI, but none of ...

Navigating within components using code is an essential skill when working with Vue Router

I am currently developing a Quasar application powered by Vue 3 with vue-router version 4 All my routes are properly configured and function well when navigating from a component template using <router-link to="/route">Go to route</rout ...

The error message "ER_BAD_FIELD_ERROR: The column 'table.column' is not recognized in the 'on clause'" is displayed

I am encountering a perplexing issue... I'm attempting to execute a query: SELECT ordenes_servicio.idorden, estatus_orden.descripcion AS estatus, tipo_orden.descripcion AS tipo_orden, usuario.nombre, ordenes_servicio.nombres_cliente, ordenes_servicio ...

A guide on retrieving data from Firestore using TypeScript

I've been diving into a chat project using Angular, and Firestore has given me a bit of trouble. Trying to get the hang of typescript while working with it. Within app.module.ts, kicking things off with: import { provideFirebaseApp, getApp, initi ...

Showing Angular dropdown menu using Java HashMap

I am trying to fetch and display data from a HashMap in my Angular application by making a GET request to a Spring Application. Here is the code I have tried: Spring code: @GetMapping("gateways") public ResponseEntity<?> getGateways() { Map< ...

Dynamic Material UI Timeline

I am facing a challenge with making the Timeline in Material UI responsive for the first time. Currently, I have it set to align 'alternate', but I want it to switch to align 'left' when viewed on mobile or certain screen widths. I have ...

What is the best way to implement custom serialization for Date types in JSON.stringify()?

class MyClass { myString: string; myDate: Date; } function foo() { const myClassArray: MyClass[] = .... return JSON.stringify(myClassArray); // or expressApp.status(200).json(myClassArray); } foo will generate a JSON string with the date format o ...

typescript extending a type from a higher-level interface

Consider the TypeScript interface provided below: export interface Update { type: 'STATUS_UPDATE'; } I am interested in extending this interface by adding one more value to the type property, as shown here: export interface HttpUpdate extends ...