associative array signature value in function return type - no static type checking ?

Topics: General, Language Specification
Jan 2, 2013 at 5:45 PM
Edited Jan 2, 2013 at 5:49 PM

I'm playing with the latest TypeScript (0.8.1.1).  My code:

class MyClass {
    getStringToStringArrayDict(): { [index: string]: string[]; } {
        return {
            "key-1": ["value-1", "value-2"],
            "key-2": [new MyClass()], //// no warnings or errors
            "key-3": new MyClass() //// no warnings or errors
        }
    }
}

It looks like there isn't any static type checking on the return type of the function.  Bug ?

Coordinator
Jan 3, 2013 at 3:08 PM

Looks like a bug to me, too.  Moving to the issue tracker.

Coordinator
Jan 3, 2013 at 3:08 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.