Angular-cli: @ngtools/webpack TS Error on build of project

Created on 23 Aug 2017  路  9Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Node 8.1.0
NPM 5.0.3
ngtools/webpack 1.7.0-beta.2
Angular 5.0.0-beta.2
Typescript 2.4.2

The log given by the failure.

TS2420: Class 'VirtualStats' incorrectly implements interface 'Stats'.
Property 'atimeMs' is missing in type 'VirtualStats'.

Desired functionality.

Compiles correctly

Most helpful comment

Downgrading to @types/node 8.0.19 temporary solved the problem.

All 9 comments

I have the same problem.
It only happens with awesome-typescript-loader.
Switching to ts-loader resolved the problem for me.

I just tried changing to ts-loader, same error. Care to share your part of the config that you have setup, see if I am doing it right.

Temporary solved it by adding the following attributed from fs.Stats to the VirtualStats class
readonly atimeMs: number; readonly mtimeMs: number; readonly ctimeMs: number; readonly birthtimeMs: number;

Seems like the node api changed..

Using:

  • node 8.1.3
  • npm 5.2.0
  • types/node 8.0.25
  • ngtools/webpack 1.6.2

Downgrading to @types/node 8.0.19 temporary solved the problem.

Unfortunately still an issue. :(

You can work around this without downgrading @types/node by adding the following to a .d.ts file, and making sure that file is included in your tsconfig.json:

// https://github.com/angular/angular-cli/issues/7474
import { VirtualStats } from '@ngtools/webpack/src/compiler_host';
import * as fs from 'fs';

declare module '@ngtools/webpack/src/compiler_host' {
    interface VirtualStats extends fs.Stats {
        atimeMs: number;
    }
}

Can you still reproduce this error?

Closing the issue due to inactivity. If the problem still exists in the latest version of the CLI, please open a new issue following the template and providing a minimal demo where we can reproduce it. Thanks! :-)

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings