3

What is the scope of a typescript type alias? I have this alias and I think that I might want to declare it globally somehow:

type ResouceResult<T> = T & {
    $promise: ng.IPromise<T>,
    $resolved: boolean
};
mortb
  • 9,361
  • 3
  • 26
  • 44

2 Answers2

2

Section 3.9 of Typescript 1.5 language specification: http://www.typescriptlang.org/Content/TypeScript%20Language%20Specification.pdf

3.9 Type Aliases

A type alias declaration introduces a type alias in the containing module

so module

Bruno Grieder
  • 28,128
  • 8
  • 69
  • 101
2

declare it globally

If your file is a global, the type alias is global. If its a module, the type alias is a module.

More on this: https://basarat.gitbook.io/typescript/project/modules

basarat
  • 261,912
  • 58
  • 460
  • 511