No output when using Typescript 2.0

Recently, I've been working on a project in VS 2015 update 3 and just integrated Typescript 2.0.

Initially, I encountered a lot of errors and had to go through a trial and error process to resolve them. Now, all the errors have been fixed but I'm facing an issue with my output file.

All my source files are located in the client folder, which is situated in the root directory of the project.

Here's a glimpse of my tsconfig.json:

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "amd",
    "noImplicitAny": true,
    "noEmitOnError": true,
    "moduleResolution": "node",
    "removeComments": true,
    "sourceMap": true,
    "target": "es5",
    "outDir": "./client",
    "outFile": "./client/app.js",
    "sourceRoot": "./client"
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

The project successfully compiled when it was using version 1.8.x.

For instance, take a look at one of my .ts files:

namespace app {
    'use strict';

    angular
        .module('app', [
            'ngRoute',
            'ngAnimate',
            'officeuifabric.core',
            'officeuifabric.components'
        ]);

}

Could there be something that I'm overlooking?

---edit--- I noticed that if I remove these lines:

"outDir": "./client",
"outFile": "./client/app.js",
"sourceRoot": "./client"

the build process runs smoothly without any issues. Are these parameters still valid?

--edit 2-- I also experimented with an empty project in VS Code and the tsc command line tool.

Here's the tsconfig configuration that works:

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "amd",
    "noImplicitAny": true,
    "noEmitOnError": true,
    "moduleResolution": "node",
    "removeComments": true,
    "sourceMap": true,
    "target": "es5",
    "outFile": "app.js",
    "sourceRoot": "./client"
  },
  "exclude": [
    "node_modules"
  ]
}

However, whenever I add Outdir, either nothing gets compiled or it ends up in the wrong location.

One solution that does work is:

    "outFile": "./build/app.js",

Answer №1

The issue I encountered was slightly different. Originally, my configuration included

"extends": "@tsconfig/react-native/tsconfig.json"
, and the imported tsconfig file had "noEmit": true. Resolving it required adding an explicit "noEmit": false in my own configuration.

Answer №2

Here is the configuration that has been effective for me:

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "umd",
    "strictNullChecks": true,
    "noEmitOnError": false,
    "moduleResolution": "classic",
    "removeComments": false,
    "sourceMap": true,
    "target": "es6",
    "outFile": "./dist/bundle.js"
  },
  "exclude": [
    "build",
    "temp"
  ]
}

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

Design an element that stretches across two navigation bars

Currently, I have implemented two Navbars on my website as shown in the image below: https://i.stack.imgur.com/4QmyW.png I am now looking to include a banner that clearly indicates that this site is a test site. In addition, I would like to incorporate a ...

Issue in Angular Material: The export 'MaterialComponents' could not be located in './material/material.module'

I'm relatively new to Angular and I am encountering some difficulties when trying to export a material module. The error message that appears is as follows: (Failed to compile.) ./src/app/app.module.ts 17:12-30 "export 'MaterialComponents&ap ...

Can models drive reactive forms by automatically mapping them to FormGroups?

Is it possible to automatically generate a FormGroup from a Model? If I have a Model with multiple Properties: Model: Person firstName: string, lastName: string, street: string, country: string .... And I would like to create a basic FormGroup based on ...

Typescript often fails to recognize that every code path within a function should return a value

Is it possible to inform TypeScript that all potential code paths in a function will return a value? In my scenario, I provide two numeric arrays as input, verify their monotonically increasing nature, and then retrieve a value based on specific condition ...

Learn how to send an SMS using Angular and Ionic 4 without having to open the native SMS app

I have been actively monitoring the GitHub repository for the Ionic Native SMS plugin at https://github.com/cordova-sms/cordova-sms-plugin. Following the suggested configuration from the repo, I have set it up as follows: var options = { repla ...

Tips for Implementing Error Handling in Angular using Sweetalert2

On this code snippet, I have implemented a delete confirmation popup and now I am looking to incorporate error handling in case the data is not deleted successfully. confirmPopUp(){ Swal.fire({ title: 'Are You Sure?', text: 'Deleti ...

Change the return type of every function within the class while maintaining its generic nature

Looking for a solution to alter the return type of all functions within a class, while also maintaining generics. Consider a MyService class: class CustomPromise<T> extends Promise<T> { customData: string; } interface RespSomething { data ...

Automate the compilation of Typescript project references by creating a solution that allows for passing unique options to each

When compiling or building a project with references programmatically, I make use of the ts.createSolutionBuilder API. The challenge I face is that in my specific scenario, I do not have individual tsconfig.json files stored on the filesystem for each pac ...

Emphasize the text based on the content in Angular

database of customers check customer records customer service module access service details component for user details display view user details component 1 view user details component 2 template file for user details component see HTML template Seek ...

tsc and ts-node are disregarding the noImplicitAny setting

In my NodeJS project, I have @types/node, ts-node, and typescript installed as dev dependencies. In the tsconfig.json file, "noImplicitAny": true is set. There are three scripts in the package.json file: "start": "npm run build &am ...

Encountering an ExpressionChangedAfterItHasBeenCheckedError in Angular 6 when selecting an option from a dropdown menu

How can we fix the error mentioned below through code changes? Situation An input dropdown UI is safeguarded against unintentional value changes by a modal. However, triggering an event (such as click or focus) on the dropdown leads to the ExpressionChan ...

How can I retrieve data during a double-click event in Kendo Grid using Angular?

How can I retrieve data on the doubleClick event in a Kendo Grid? I want to access the same object that is fetched during the selected event, which would be the dataitem at the selected index row. HTML: <kendo-grid #myGrid [data]="gridDat ...

Vue3: The module './assets/logo.png' and its corresponding type declarations are not found

The project was created using the following command: vue create testtype3 Link to image: https://i.sstatic.net/vMuq0.png App.vue: <template> <img alt="Vue logo" src="./assets/logo.png"> <img :src="MyIcon" ...

Converting an array of objects into a TypeScript dictionary with IDs as the key mapping

Is there a way to provide type hints for better autocompletion when accessing keys like dictionary.Germany from the following data and types? type Entry = { tld: string; name: string; population: number; }; const data: Entry[] = [ {tld: 'de&a ...

Tips for transmitting data from Dart to Typescript Cloud functions, encountering the UNAUTHENTICATED error code

Snippet of Dart code with token passed to sendToDevice: Future<void> _sendNotification() async { CloudFunctions functions = CloudFunctions.instance; HttpsCallable callable = functions.getHttpsCallable(functionName: "sendToDevice"); callable.c ...

The Angular 6 test command using npm has encountered a failure

I've been encountering a disconnect error while attempting to run Angular test cases. With over 1500 test cases written, it appears that the sheer volume may be causing this issue. Is there a way to resolve the disconnect error when running such a lar ...

Angular's observables were unable to be subscribed to in either the constructor or ngOnInit() functions

Currently, I am incorporating an observable concept into my application. In this setup, a service is called by component1 to emit an event that is then subscribed to by component 2. Below is the code snippet for reference: Service Code export class Mes ...

Tips for transferring data when clicking in Angular 5 from the parent component to the child component

I need assistance with passing data from a parent component to a child component in Angular 5. I want the child component to render as a separate page instead of within the parent's template. For example, let's say my child component is called & ...

Aurelia validation is failing to work properly when the form is already populated with data

Struggling to implement validation on an edit model-view that is data-bound in the activate method of its view-model. The create.ts file works smoothly with similar code, but without the need to load data. Surprisingly, the validation functions correctly ...

Error message encountered in Typescript eslint: File extension "ts" is missing in import statement for the specified file

I am encountering an issue with my Node/Express application created using Typescript. The problem lies in eslint throwing an error that says: Missing file extension "ts" for "./lib/env" import/extensions Below is the content of my .eslintrc file: { ...