This project is read-only.

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

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

I'm playing with the latest TypeScript (  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 ?

Jan 3, 2013 at 4:08 PM

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

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