Gettings lots of falsy errors with 0.9.1

Topics: General
Aug 19, 2013 at 2:20 PM
I try to get my project compiling with 0.9.1 (previously 0.8.3.1), but that appears not to be easy :-(.
I get several falsy errors:
  • Operator '<' cannot be applied to types 'number' and 'number'
  • above error also seen for > and == operators
  • Function 'xxx' declared a non-void return type, but has no return expression. (But the function has a void return type in the signature: function xxx() : void {})
  • Constructors for derived classes must contain a 'super' call (But that call is in fact in place).
  • Lots of errors on types in lib.d.ts saying: "All named properties must be subtypes of string indexer type 'any'"
Very weird.
Coordinator
Aug 19, 2013 at 7:27 PM
Do you have a repro for the issues above?
  • I just tried out #1, #2, and #3 in the playground and don't seem to see the same issues.
  • There are a number of changes in lib.d.ts between 0.8.3.1 and 0.9.1. Are you using the 0.9.1 version?
Aug 20, 2013 at 5:18 PM
Edited Aug 20, 2013 at 5:21 PM
  • "Constructors for derived classes must contain a 'super' call (But that call is in fact in place).
Happens for me as well. Copied a perfectly functioning class within a huge a project. Stripped it clean and renamed it. This will not sound logical at all, but within my project the error seems to be produced by calling a get-property of childitem within the constructor. Funnily enough, this will also produce the same error on all other constructors following the one with the false error.

App.Data.Vessels is
public get Vessels(): someType[] { }

App and Data are both instantiated Classes, the later exposed as a get-Property within App.

as soon as i add
var list = App.Data.Vessels;
anywhere within my classes constructor (after super() of course), i get the false error.

The icing on the cake being: If i wrap the call within an anonymous function or a member function within the class i can call that function from within the constructor without the error being thrown....
Coordinator
Aug 20, 2013 at 7:10 PM
@hswolfmathes - do you have an example class (or pair of classes) it stopped working for?

I know that we did tighten things down with getters with 0.9.1, since you can't call the getter of a parent class.
Aug 20, 2013 at 10:53 PM
Also seeing lots of errors being generated related to lib.d.ts:
Error   5   Rest parameters must be array types.    lib.d.ts    398 12  shell.ts
Error   2   Duplicate overload construct signature. lib.d.ts    250 5   shell.ts
Error   15  All named properties must be subtypes of string indexer type 'number'.  lib.d.ts    476 5   shell.ts
Error   70  All named properties must be subtypes of string indexer type 'any'. lib.d.ts    1692    5   shell.ts
...
Error   101 More than 100 errors in program, remaining errors not displayed.    lib.d.ts    1   1   shell.ts
Errors seem to appear randomly after some time of working within the VS2012 editor. Restarting VS2012 causes the errors to disappear. Not sure exactly how to repro yet.

Environment: VS 2012 Update 3, TS 0.9.1.0 (Auto compile TS file which are part of a project - Enabled), WE 2.9 (Compile on Save and on Build - Disabled; Show Preview Window - Disabled)
Aug 21, 2013 at 8:41 AM
As RWHepburn says, it seems indeed to appear after some time of working in VS2012.

After a fresh start of VS2012 I get this very helpful error:

Error 1 Unable to get property 'kind' of undefined or null reference C:\Dev\XFramework\Main\Xperit.Framework.Web.NAV.Site\VSTSC Xperit.Framework.Web.NAV.Site

The command line compiler gives the same error:
tsc.js(40468, 28) JavaScript runtime error: Unable to get property 'kind' of undefined or null reference

I have no clue where to start finding the error in my code (if any)

10 times rebuilding the project in VS, does not give the falsy errors.
So I think it has to do with the implicit compiling when editing the code and using intellisense.

BTW: I have the same environment as RWHepbrun.
Aug 21, 2013 at 9:21 AM
Edited Aug 21, 2013 at 9:23 AM
I was able to reproduce the error with the following 2 files. Putting the code into a single file will not throw the error

app.ts
class Main {
    public get Sub(): any {
        //return 42;
        //return "Bob";
        return null;
    }     
}

var App = new Main();
broken.ts
/// <reference path="app.ts" />

class SomeBase {
    constructor() {

    }
}

class BrokenClass extends SomeBase {
    constructor() {
        super();
        var list = App.Sub;
    }
}
EDIT: Environment is VS2012 60610.01 with TS 0.9.1 and Web Essentials 2.9
Developer
Aug 21, 2013 at 7:42 PM
Were you seeing the same compiler crash mentioned above?

tsc.js(40468, 28) JavaScript runtime error: Unable to get property 'kind' of undefined or null reference

In the current bits in the develop branch the code above compiles without error for me.
Aug 21, 2013 at 9:55 PM
Things seem to have stabilized now that I have installed today's 0.9.1.1 release but I haven't had much time today to evaluate the hotfix these problems. Initial impression is that the problems are fixed in 0.9.1.1. I'd suggest you upgrade and see if that helps.
Aug 22, 2013 at 9:59 AM
I installed 0.9.1.1. I have not yet seen any falsy errors, but I have not yet spend much time editing typescript in VS.

It didn't solve the "tsc.js(40468, 28) JavaScript runtime error: Unable to get property 'kind' of undefined or null reference " error.
But I spend some hours compile my typescript files with tsc, adding them one by one to the project, until I found the offending line.

If I add a file with this code to my project, the compiler crashes:
module mymodule {
    export class ScrollTable {
        private _content: JQuery;

        public horzScrollVisible() {
            return this._content[0].scrollHeight > this._content[0].offsetHeight;
        }
    }
}
The error is cause by the return statement. If I change that line to "return false;" or " return this.i > this.j" (declaring i and j as number), then the error does not occur.

But this does not occur when this is the only file in my project, but it occurs when I add it to my project containing 19 typescript files with about total 2800 lines of code and using 4 d.ts files (Kendo, JQuery, Modernirz, SignalR (last 3 from DefinitelyTyped))
So it is not reproducible in a small project. Maybe you have now some hints to search for the problem.

(If the helps you to reproduce, I can sent my files by e-mail to somebody of the team)
Aug 25, 2013 at 5:28 PM
JaapM wrote:
I try to get my project compiling with 0.9.1 (previously 0.8.3.1), but that appears not to be easy :-(.
I get several falsy errors:
  • Operator '<' cannot be applied to types 'number' and 'number'
  • above error also seen for > and == operators
  • Function 'xxx' declared a non-void return type, but has no return expression. (But the function has a void return type in the signature: function xxx() : void {})
  • Constructors for derived classes must contain a 'super' call (But that call is in fact in place).
  • Lots of errors on types in lib.d.ts saying: "All named properties must be subtypes of string indexer type 'any'"
Very weird.
I've had every single one of those errors (and more!) and I can assure you that each of those errors are completely bogus. Do not waste any of your time trying to eliminate them or debug them, they are NOT genuine errors at all. Basically the tsc compiler has crapped out on something completely and utterly unrelated to the above, and those are just the cascading pile of errors that are served in the wake of the compiler bail out.

There are some debugging suggestions from the TS team in my original thread where I talk about the above issues too, but it requires compiling via node.js instead. Even so, might be useful to read: https://typescript.codeplex.com/discussions/453115
Aug 26, 2013 at 7:39 AM
@PhotonStorm: I didn't spend any time on finding the cause of that error messages. It was clear that they could not be genuine errors at all.
As I wrote in my previous message, I already found the real problem, so my project is not compiling fine.
Sep 17, 2013 at 3:16 PM
Is anyone else still experiencing this issue?

VS2012, just upgraded TypeScript to 0.9.1.1

After a random amount of time, 100+ lib.d.ts errors appear. Things like 'All named properties must be subtypes of string indexer type 'any'.

Restarting VS makes them go away - for a while.
Sep 18, 2013 at 6:09 AM
Edited Sep 18, 2013 at 6:10 AM
I think this is related to the way VStudio compiles/caches results.

This seems to be a repro (untested in isolation) for me:
  • Have file A.ts
  • Have file B.ts that references A.ts
  • Break something in A.ts
  • In some cases, B.ts will recompile and give the appropriate compiler errors while A.ts is broken but won't refresh when A.ts is saved with the fixed code
  • The errors appear falsey because the code is not really broken, but it was at the point in time that TS recompiled
Please investigate, this is the #1 TS hazard for me right now.
Sep 18, 2013 at 11:41 AM
Am I right in thinking that

/// <reference ...

is no longer required and that TS handles it automatically? I removed all references in my project in the optimistic hope that it would solve this issue. It seemed to for a little bit. Not any more!

The compiler still compiles. I just see lots of non-existent errors in the list.
Sep 18, 2013 at 6:59 PM
I didn't know about implicit referencing but I think the problem can occur in the way I describe regardless of implicit or explicit referencing.
It seems to be related to some sort of caching.
Sep 23, 2013 at 11:21 AM
Is anyone looking into this? It's getting quite annoying :S
Oct 8, 2013 at 10:47 AM
thebrentflood wrote:
Is anyone else still experiencing this issue?

VS2012, just upgraded TypeScript to 0.9.1.1

After a random amount of time, 100+ lib.d.ts errors appear. Things like 'All named properties must be subtypes of string indexer type 'any'.

Restarting VS makes them go away - for a while.
I have the exact same problem here. Makes working with TS 0.9 very impractical. :(
Oct 8, 2013 at 10:53 AM
Do you have Web Essentials installed? Disabling it made it go away - not sure if completely but definitely less frequent
Oct 8, 2013 at 10:56 AM
Yes, I'm using WebEssentials 2.9. I will try disabling it and/or upgrading with the latest version with no TS support.
Oct 8, 2013 at 10:58 AM
And if it seems to go away, we need to report the bug to the creator
Coordinator
Oct 11, 2013 at 4:29 PM
If removing WebEssentials doesn't fix the issue, please let us know by filing an issue in the issue tracker.
Oct 11, 2013 at 4:44 PM
It keeps happening for me too - open an issue here: https://typescript.codeplex.com/workitem/1780