Does the word "Generics" have special meaning?

Topics: Language Specification
May 14, 2013 at 2:21 AM
I was testing generics with the following code and if I name the module "Generics" it errors. The example works if the module is renamed to anything else, such as "Example". Does the word Generics have special meaning?
    module Generics {
        export interface IMyClass {
            name: string;
        }

        export interface IExample<T extends IMyClass> {
            getById(id: number): T;
        }

        export class MyClass implements IMyClass {
            public name: string;

            constructor() {
                this.name = 'A string';
            }
        }

        export class Example implements IExample<MyClass> {
            getById(id: number) {
                return new MyClass();
            }
        }
    }
Coordinator
May 14, 2013 at 8:15 PM
Generics isn't special in the language. When you say "it errors", can you be more specific? This works for me without any errors.
May 14, 2013 at 8:25 PM
Hmmm. When I try to recreate this it is no longer a problem. I was using TypeScript 0.9 in VS 2012 and literally if I changed the module name to "Generics" I got a bunch of compilation errors and when I changed it to "Example" it worked. I tried it five times last night. Today this isn't a problem at all. Kinda glad I started a discussion not an issue, because now I just look mostly stupid rather than completely stupid. Happy days.
Coordinator
May 15, 2013 at 3:14 PM
This may actually not be related to renaming it specifically to "Generics", but could be from the incremental editor getting into a bad state. We've been doing a lot of polish on this front for weeks, but there could be lingering issues that still need to get ironed out.
May 15, 2013 at 3:55 PM
This is even better news - the chances are that I am mostly not stupid at all. I haven't seen the issue again, so it isn't major - but I have seen it in the Playground where it remembers something you deleted and gets confused.

Thanks for the update.