Emit global context declarations into the declaration file

This commit is contained in:
Sheetal Nandi
2014-07-11 14:44:31 -07:00
parent da4547ff5a
commit ea7c23eb63
598 changed files with 5903 additions and 53 deletions
+31 -24
View File
@@ -33,7 +33,7 @@ module ts {
return !!(sourceFile.flags & (NodeFlags.ExternalModule | NodeFlags.DeclarationFile));
}
function findConstructor(node: ClassDeclaration): ConstructorDeclaration {
function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration {
return forEach(node.members, member => {
if (member.kind === SyntaxKind.Constructor && (<ConstructorDeclaration>member).body) {
return <ConstructorDeclaration>member;
@@ -1352,7 +1352,7 @@ module ts {
}
function emitClassDeclaration(node: ClassDeclaration) {
var ctor = findConstructor(node);
var ctor = getFirstConstructorWithBody(node);
write("var ");
emit(node.name);
write(" = (function (");
@@ -1866,7 +1866,7 @@ module ts {
}
}
function emitCommaTypeList(nodes: Node[]) {
function emitCommaSeparatedSymbolToString(nodes: Node[]) {
if (nodes) {
for (var i = 0, n = nodes.length; i < n; i++) {
if (i) {
@@ -1901,7 +1901,8 @@ module ts {
//TODO: only emit when export flag once the above condition is modified
write("export ");
write("import ");
write(getSourceTextOfLocalNode(node.name) + " = ");
emitSourceTextOfNode(node.name);
write(" = ");
if (node.entityName) {
emitSourceTextOfNode(node.entityName);
write(";");
@@ -1915,17 +1916,22 @@ module ts {
}
}
function canEmitDeclaration(node: Declaration) {
if (node.parent.kind === SyntaxKind.ModuleDeclaration || node.parent.kind === SyntaxKind.SourceFile) {
if (!(node.flags & NodeFlags.Export)) {
// Non exported member
// TODO(shkamat): check if the symbol at this location is externally visible
// eg. because of export assignment or is in global context because source file is non external module
return false;
function canEmitModuleElementDeclaration(node: Declaration) {
if (node.flags & NodeFlags.Export) {
// Exported member - emit this declaration
return true;
}
if (node.parent.kind === SyntaxKind.SourceFile) {
// Global context nodes - emit this declaration
if (!(node.parent.flags & NodeFlags.ExternalModule)) {
return true;
}
}
return true;
// TODO(shkamat): check if this node is part of export assignment in the external module
return false;
}
function emitDeclarationFlags(node: Declaration) {
@@ -1954,7 +1960,7 @@ module ts {
}
function emitModuleDeclaration(node: ModuleDeclaration) {
if (canEmitDeclaration(node)) {
if (canEmitModuleElementDeclaration(node)) {
emitDeclarationFlags(node);
write("module ");
emitSourceTextOfNode(node.name);
@@ -1974,7 +1980,7 @@ module ts {
}
function emitEnumDeclaration(node: EnumDeclaration) {
if (canEmitDeclaration(node)) {
if (canEmitModuleElementDeclaration(node)) {
emitDeclarationFlags(node);
write("enum ");
emitSourceTextOfNode(node.name);
@@ -2002,7 +2008,7 @@ module ts {
function emitTypeParameters(typeParameters: TypeParameterDeclaration[]) {
if (typeParameters) {
write("<");
emitCommaTypeList(typeParameters);
emitCommaSeparatedSymbolToString(typeParameters);
write(">");
}
}
@@ -2010,14 +2016,14 @@ module ts {
function emitHeritageClause(typeReferences: TypeReferenceNode[], isImplementsList: boolean) {
if (typeReferences) {
write(isImplementsList ? " implments " : " extends ");
emitCommaTypeList(typeReferences);
emitCommaSeparatedSymbolToString(typeReferences);
}
}
function emitClassDeclaration(node: ClassDeclaration) {
function emitParameterProperties(node: ConstructorDeclaration) {
if (node) {
forEach(node.parameters, param => {
function emitParameterProperties(constructorDeclaration: ConstructorDeclaration) {
if (constructorDeclaration) {
forEach(constructorDeclaration.parameters, param => {
if (param.flags & (NodeFlags.Public | NodeFlags.Private)) {
emitPropertyDeclaration(param);
}
@@ -2025,7 +2031,7 @@ module ts {
}
}
if (canEmitDeclaration(node)) {
if (canEmitModuleElementDeclaration(node)) {
emitDeclarationFlags(node);
write("class ");
emitSourceTextOfNode(node.name);
@@ -2037,7 +2043,7 @@ module ts {
write(" {");
writeLine();
increaseIndent();
emitParameterProperties(findConstructor(node));
emitParameterProperties(getFirstConstructorWithBody(node));
emitLines(node.members);
decreaseIndent();
write("}");
@@ -2046,7 +2052,7 @@ module ts {
}
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
if (canEmitDeclaration(node)) {
if (canEmitModuleElementDeclaration(node)) {
emitDeclarationFlags(node);
write("interface ");
emitSourceTextOfNode(node.name);
@@ -2081,7 +2087,7 @@ module ts {
}
function emitVariableStatement(node: VariableStatement) {
if (canEmitDeclaration(node)) {
if (canEmitModuleElementDeclaration(node)) {
emitDeclarationFlags(node);
write("var ");
emitCommaList(node.declarations);
@@ -2106,7 +2112,8 @@ module ts {
function emitFunctionDeclaration(node: FunctionDeclaration) {
// TODO(shkamat): if this is overloaded declaration do not emit if body is present
if (canEmitDeclaration(node)) {
// If we are emitting Method/Constructor it isnt moduleElement and doesnt need canEmitModuleElement check
if (node.kind !== SyntaxKind.FunctionDeclaration || canEmitModuleElementDeclaration(node)) {
emitDeclarationFlags(node);
if (node.kind === SyntaxKind.FunctionDeclaration) {
write("function ");
@@ -118,3 +118,40 @@ var i8_c = c8;
//// [commentsClass.d.ts]
declare class c2 {
}
declare var i2;
declare var i2_c;
declare class c3 {
constructor ();
}
declare var i3;
declare var i3_c;
declare class c4 {
constructor ();
}
declare var i4;
declare var i4_c;
declare class c5 {
static s1;
}
declare var i5;
declare var i5_c;
declare class c6 {
static s1;
constructor ();
}
declare var i6;
declare var i6_c;
declare class c7 {
static s1;
constructor ();
}
declare var i7;
declare var i7_c;
declare class c8 {
static s1;
constructor ();
}
declare var i8;
declare var i8_c;
@@ -438,3 +438,68 @@ cProperties_i.nc_p2 = cProperties_i.nc_p1;
//// [commentsClassMembers.d.ts]
declare class c1 {
p1;
p2(b);
p3;
private pp1;
private pp2(b);
private pp3;
constructor ();
static s1;
static s2(b);
static s3;
nc_p1;
nc_p2(b);
nc_p3;
private nc_pp1;
private nc_pp2(b);
private nc_pp3;
static nc_s1;
static nc_s2(b);
static nc_s3;
a_p1;
a_p2(b);
a_p3;
private a_pp1;
private a_pp2(b);
private a_pp3;
static a_s1;
static a_s2(b);
static a_s3;
b_p1;
b_p2(b);
b_p3;
private b_pp1;
private b_pp2(b);
private b_pp3;
static b_s1;
static b_s2(b);
static b_s3;
}
declare var i1;
declare var i1_p;
declare var i1_f;
declare var i1_r;
declare var i1_prop;
declare var i1_nc_p;
declare var i1_ncf;
declare var i1_ncr;
declare var i1_ncprop;
declare var i1_s_p;
declare var i1_s_f;
declare var i1_s_r;
declare var i1_s_prop;
declare var i1_s_nc_p;
declare var i1_s_ncf;
declare var i1_s_ncr;
declare var i1_s_ncprop;
declare var i1_c;
declare class cProperties {
private val;
p1;
nc_p1;
p2;
nc_p2;
}
declare var cProperties_i;
@@ -224,3 +224,28 @@ var NoQuickInfoClass = (function () {
//// [commentsCommentParsing.d.ts]
declare function simple();
declare function multiLine();
declare function jsDocSingleLine();
declare function jsDocMultiLine();
declare function jsDocMultiLineMerge();
declare function jsDocMixedComments1();
declare function jsDocMixedComments2();
declare function jsDocMixedComments3();
declare function jsDocMixedComments4();
declare function jsDocMixedComments5();
declare function jsDocMixedComments6();
declare function noHelpComment1();
declare function noHelpComment2();
declare function noHelpComment3();
declare function sum(a, b);
declare function multiply(a, b, c?, d?, e?);
declare function f1(a);
declare function f1(b);
declare function f1(aOrb, opt?);
declare function subtract(a, b, c?, d?, e?, f?);
declare function square(a);
declare function divide(a, b);
declare function jsDocParamTest(a, b, c, d);
declare class NoQuickInfoClass {
}
@@ -23,3 +23,8 @@ x = 1 /* FancyPink */;
//// [commentsEnums.d.ts]
declare enum Colors {
Cornflower = 0,
FancyPink = 1,
}
declare var x;
@@ -124,7 +124,6 @@ define(["require", "exports", "commentsExternalModules_0"], function (require, e
//// [commentsExternalModules_0.d.ts]
export declare module m1 {
var b;
function foo();
module m2 {
class c {
}
@@ -134,7 +133,6 @@ export declare module m1 {
}
export declare module m4 {
var b;
function foo();
module m2 {
class c {
}
@@ -42,3 +42,8 @@ lambddaNoVarComment(10, 20);
//// [commentsFunction.d.ts]
declare function foo();
declare function fooWithParameters(a, b);
declare var fooFunc;
declare var lambdaFoo;
declare var lambddaNoVarComment;
@@ -258,3 +258,86 @@ i2_i = i3_i;
//// [commentsInheritance.d.ts]
interface i1 {
i1_p1;
i1_f1();
i1_l1;
i1_nc_p1;
i1_nc_f1();
i1_nc_l1;
p1;
f1();
l1;
nc_p1;
nc_f1();
nc_l1;
}
declare class c1 implments i1 {
i1_p1;
i1_f1();
i1_l1;
i1_nc_p1;
i1_nc_f1();
i1_nc_l1;
p1;
f1();
l1;
nc_p1;
nc_f1();
nc_l1;
}
declare var i1_i;
declare var c1_i;
declare class c2 {
c2_p1;
c2_f1();
c2_prop;
c2_nc_p1;
c2_nc_f1();
c2_nc_prop;
p1;
f1();
prop;
nc_p1;
nc_f1();
nc_prop;
constructor (a);
}
declare class c3 extends c2 {
constructor ();
p1;
f1();
prop;
nc_p1;
nc_f1();
nc_prop;
}
declare var c2_i;
declare var c3_i;
declare class c4 extends c2 {
}
declare var c4_i;
interface i2 {
i2_p1;
i2_f1();
i2_l1;
i2_nc_p1;
i2_nc_f1();
i2_nc_l1;
p1;
f1();
l1;
nc_p1;
nc_f1();
nc_l1;
}
interface i3 extends i2 {
p1;
f1();
l1;
nc_p1;
nc_f1();
nc_l1;
}
declare var i2_i;
declare var i3_i;
@@ -103,3 +103,46 @@ i3_i.nc_l(10);
//// [commentsInterface.d.ts]
interface i1 {
}
declare var i1_i;
interface nc_i1 {
}
declare var nc_i1_i;
interface i2 {
x;
foo;
[i];
new (i);
nc_x;
nc_foo;
[i];
(a, b);
fnfoo(b);
nc_fnfoo(b);
nc_y;
}
declare var i2_i;
declare var i2_i_x;
declare var i2_i_foo;
declare var i2_i_foo_r;
declare var i2_i_i2_si;
declare var i2_i_i2_ii;
declare var i2_i_n;
declare var i2_i_nc_x;
declare var i2_i_nc_foo;
declare var i2_i_nc_foo_r;
declare var i2_i_r;
declare var i2_i_fnfoo;
declare var i2_i_fnfoo_r;
declare var i2_i_nc_fnfoo;
declare var i2_i_nc_fnfoo_r;
interface i3 {
x;
f(a);
l;
nc_x;
nc_f(a);
nc_l;
}
declare var i3_i;
@@ -243,3 +243,49 @@ new m7.m8.m9.c();
//// [commentsModules.d.ts]
declare module m1 {
var b;
module m2 {
class c {
}
var i;
}
function fooExport();
function foo2Export(a);
function foo3Export();
}
declare var myvar;
declare module m2.m3 {
class c {
}
}
declare module m3.m4.m5 {
class c {
}
}
declare module m4.m5.m6 {
module m7 {
class c {
}
}
}
declare module m5.m6.m7 {
module m8 {
class c {
}
}
}
declare module m6.m7 {
module m8 {
class c {
}
}
}
declare module m7.m8 {
module m9 {
class c {
}
class e {
}
}
}
@@ -60,3 +60,15 @@ new multiM.c();
//// [commentsMultiModuleSingleFile.d.ts]
declare module multiM {
class b {
}
class d {
}
}
declare module multiM {
class c {
}
class e {
}
}
@@ -257,3 +257,106 @@ var c5_i_2 = new c5("hello");
//// [commentsOverloads.d.ts]
declare function f1(a);
declare function f1(b);
declare function f1(aOrb);
declare function f2(a);
declare function f2(b);
declare function f2(aOrb);
declare function f3(a);
declare function f3(b);
declare function f3(aOrb);
declare function f4(a);
declare function f4(b);
declare function f4(aOrb);
interface i1 {
(a);
(b);
foo(a);
foo(b);
foo(arr);
foo(arr);
foo2(a);
foo2(b);
foo3(a);
foo3(b);
foo4(a);
foo4(b);
foo4(c);
new (a);
new (b);
}
declare var i1_i;
interface i2 {
new (a);
new (b);
(a);
(b);
}
declare var i2_i;
interface i3 {
new (a);
new (b);
(a);
(b);
}
declare var i3_i;
interface i4 {
new (a);
new (b);
(a);
(b);
}
declare class c {
prop1(a);
prop1(b);
prop1(aorb);
prop2(a);
prop2(b);
prop2(aorb);
prop3(a);
prop3(b);
prop3(aorb);
prop4(a);
prop4(b);
prop4(aorb);
prop5(a);
prop5(b);
prop5(aorb);
}
declare class c1 {
constructor (a);
constructor (b);
constructor (aorb);
}
declare class c2 {
constructor (a);
constructor (b);
constructor (aorb);
}
declare class c3 {
constructor (a);
constructor (b);
constructor (aorb);
}
declare class c4 {
constructor (a);
constructor (b);
constructor (aorb);
}
declare class c5 {
constructor (a);
constructor (b);
constructor (aorb);
}
declare var c_i;
declare var c1_i_1;
declare var c1_i_2;
declare var c2_i_1;
declare var c2_i_2;
declare var c3_i_1;
declare var c3_i_2;
declare var c4_i_1;
declare var c4_i_2;
declare var c5_i_1;
declare var c5_i_2;
@@ -61,3 +61,15 @@ n4 = z2;
//// [commentsVarDecl.d.ts]
declare var myVariable;
declare var anotherVariable;
declare var aVar;
declare var anotherAnotherVariable;
declare var x;
declare var n;
declare var y;
declare var yy;
declare var z;
declare var z2;
declare var x2;
declare var n4;
@@ -8,3 +8,4 @@ var v = 1;
//// [commentsVariableStatement1.d.ts]
declare var v;
@@ -132,3 +132,33 @@ var m1;
//// [commentsdoNotEmitComments.d.ts]
declare var myVariable;
declare function foo(p);
declare var fooVar;
declare class c {
constructor ();
b;
myFoo();
prop1;
foo1(a);
foo1(b);
foo1(aOrb);
}
declare var i;
interface i1 {
(a);
new (b);
[a];
myFoo(a);
prop;
}
declare var i1_i;
declare module m1 {
class b {
x;
constructor (x);
}
module m2 {
}
}
declare var x;
@@ -132,3 +132,33 @@ var m1;
//// [commentsemitComments.d.ts]
declare var myVariable;
declare function foo(p);
declare var fooVar;
declare class c {
constructor ();
b;
myFoo();
prop1;
foo1(a);
foo1(b);
foo1(aOrb);
}
declare var i;
interface i1 {
(a);
new (b);
[a];
myFoo(a);
prop;
}
declare var i1_i;
declare module m1 {
class b {
x;
constructor (x);
}
module m2 {
}
}
declare var x;
@@ -12,3 +12,6 @@ var anotherVar;
//// [constructorTypeWithTypeParameters.d.ts]
declare var X;
declare var Y;
declare var anotherVar;
@@ -262,3 +262,13 @@ export declare class c1 {
onlySetter;
}
//// [declFileAccessors_1.d.ts]
declare class c2 {
p3;
private pp3;
static s3;
nc_p3;
private nc_pp3;
static nc_s3;
onlyGetter;
onlySetter;
}
@@ -24,6 +24,12 @@ exports.x;
//// [declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts]
declare module "SubModule" {
module m {
module m3 {
}
}
}
//// [declFileAmbientExternalModuleWithSingleExportedModule_1.d.ts]
/// <reference path='declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts' />
export declare var x;
@@ -90,3 +90,22 @@ export interface ICallSignatureWithOwnTypeParametes {
<T extends ICallSignature>(a);
}
//// [declFileCallSignatures_1.d.ts]
interface IGlobalCallSignature {
();
}
interface IGlobalCallSignatureWithParameters {
(a, b);
}
interface IGlobalCallSignatureWithRestParameters {
(a, ...rests);
}
interface IGlobalCallSignatureWithOverloads {
(a);
(a);
}
interface IGlobalCallSignatureWithTypeParameters<T> {
(a);
}
interface IGlobalCallSignatureWithOwnTypeParametes {
<T extends IGlobalCallSignature>(a);
}
@@ -13,3 +13,6 @@ var BlockIntrinsics = (function () {
//// [declFileClassWithIndexSignature.d.ts]
declare class BlockIntrinsics {
[s];
}
@@ -90,3 +90,22 @@ export interface IConstructSignatureWithOwnTypeParametes {
new <T extends IConstructSignature>(a);
}
//// [declFileConstructSignatures_1.d.ts]
interface IGlobalConstructSignature {
new ();
}
interface IGlobalConstructSignatureWithParameters {
new (a, b);
}
interface IGlobalConstructSignatureWithRestParameters {
new (a, ...rests);
}
interface IGlobalConstructSignatureWithOverloads {
new (a);
new (a);
}
interface IGlobalConstructSignatureWithTypeParameters<T> {
new (a);
}
interface IGlobalConstructSignatureWithOwnTypeParametes {
new <T extends IGlobalConstructSignature>(a);
}
@@ -243,3 +243,33 @@ export declare class ConstructorWithParameterInitializer {
constructor (x?);
}
//// [declFileConstructors_1.d.ts]
declare class GlobalSimpleConstructor {
constructor ();
}
declare class GlobalConstructorWithParameters {
constructor (a, b);
}
declare class GlobalConstructorWithRestParamters {
constructor (a, ...rests);
}
declare class GlobalConstructorWithOverloads {
constructor (a);
constructor (a);
constructor (a);
}
declare class GlobalConstructorWithPublicParameterProperty {
x;
constructor (x);
}
declare class GlobalConstructorWithPrivateParameterProperty {
private x;
constructor (x);
}
declare class GlobalConstructorWithOptionalParameterProperty {
x;
constructor (x?);
}
declare class GlobalConstructorWithParameterInitializer {
x;
constructor (x?);
}
@@ -18,3 +18,9 @@ var x = e;
//// [declFileEnumUsedAsValue.d.ts]
declare enum e {
a = 0,
b = 1,
c = 2,
}
declare var x;
@@ -73,3 +73,31 @@ var e5;
//// [declFileEnums.d.ts]
declare enum e1 {
a = 0,
b = 1,
c = 2,
}
declare enum e2 {
a = 10,
b,
c = 10,
}
declare enum e3 {
a = 10,
b,
c,
}
declare enum e4 {
a = 0,
b = 1,
c = 2,
d = 10,
e = 11,
}
declare enum e5 {
"Friday" = 0,
"Saturday" = 1,
"Sunday" = 2,
"Weekend days" = 3,
}
@@ -58,3 +58,23 @@ var D = (function () {
//// [declFileForClassWithMultipleBaseClasses.d.ts]
declare class A {
foo();
}
declare class B {
bar();
}
interface I {
baz();
}
interface J {
bat();
}
declare class D implments I, J {
baz();
bat();
foo();
bar();
}
interface I extends A, B {
}
@@ -17,3 +17,8 @@ var C = (function () {
//// [declFileForClassWithPrivateOverloadedFunction.d.ts]
declare class C {
private foo(x);
private foo(x);
private foo(x);
}
@@ -31,3 +31,9 @@ var C = (function (_super) {
//// [declFileForFunctionTypeAsTypeParameter.d.ts]
declare class X<T> {
}
declare class C extends X<() => number> {
}
interface I extends X<() => number> {
}
@@ -9,3 +9,7 @@ interface I {
//// [declFileForInterfaceWithOptionalFunction.d.ts]
interface I {
foo?(x?);
foo2?(x?);
}
@@ -10,3 +10,8 @@ interface I {
//// [declFileForInterfaceWithRestParams.d.ts]
interface I {
foo(...x);
foo2(a, ...x);
foo3(b, ...x);
}
@@ -19,3 +19,7 @@ var C = (function () {
//// [declFileForTypeParameters.d.ts]
declare class C<T> {
x;
foo(a);
}
@@ -9,3 +9,5 @@ var x1 = 1, y2 = 2, z2 = 3;
//// [declFileForVarList.d.ts]
declare var x, y, z;
declare var x1, y2, z2;
@@ -120,3 +120,9 @@ export declare function fooWithOverloads(a);
export declare function fooWithOverloads(a);
export declare function fooWithOverloads(a);
//// [declFileFunctions_1.d.ts]
declare function globalfoo();
declare function globalfooWithParameters(a, b);
declare function globalfooWithRestParameters(a, ...rests);
declare function globalfooWithOverloads(a);
declare function globalfooWithOverloads(a);
declare function globalfooWithOverloads(a);
@@ -39,3 +39,16 @@ var Baz = (function () {
//// [declFileGenericClassWithGenericExtendedClass.d.ts]
interface IFoo {
baz;
}
declare class Base<T> {
}
declare class Derived<T> extends Base<T> {
}
interface IBar<T> {
derived;
}
declare class Baz implments IBar<Baz> {
derived;
}
@@ -90,3 +90,26 @@ var templa;
//// [declFileGenericType2.d.ts]
declare module templa.mvc {
}
declare module templa.mvc {
}
declare module templa.mvc {
}
declare module templa.mvc.composite {
}
declare module templa.dom.mvc {
interface IElementController<ModelType extends templa.mvc.IModel> extends templa.mvc.IController<ModelType> {
}
}
declare module templa.dom.mvc {
class AbstractElementController<ModelType extends templa.mvc.IModel> extends templa.mvc.AbstractController<ModelType> implments IElementController<ModelType> {
constructor ();
}
}
declare module templa.dom.mvc.composite {
class AbstractCompositeElementController<ModelType extends templa.mvc.composite.ICompositeControllerModel> extends templa.dom.mvc.AbstractElementController<ModelType> {
_controllers;
constructor ();
}
}
@@ -22,3 +22,10 @@ var List = (function () {
//// [declFileImportedTypeUseInTypeArgPosition.d.ts]
declare class List<T> {
}
declare module 'mod1' {
}
declare module 'moo' {
var p;
}
@@ -54,3 +54,16 @@ export interface IIndexSignatureWithTypeParameter<T> {
[a];
}
//// [declFileIndexSignatures_1.d.ts]
interface IGlobalStringIndexSignature {
[s];
}
interface IGlobalNumberIndexSignature {
[n];
}
interface IGlobalBothIndexSignature {
[s];
[n];
}
interface IGlobalIndexSignatureWithTypeParameter<T> {
[a];
}
@@ -35,3 +35,14 @@ var m2;
//// [declFileInternalAliases.d.ts]
declare module m {
class c {
}
}
declare module m1 {
var d;
}
declare module m2 {
export import x = m.c;
var d;
}
@@ -360,3 +360,36 @@ export interface I1 {
fooWithOverloads(a);
}
//// [declFileMethods_1.d.ts]
declare class c2 {
foo();
fooWithParameters(a, b);
fooWithRestParameters(a, ...rests);
fooWithOverloads(a);
fooWithOverloads(a);
fooWithOverloads(a);
private privateFoo();
private privateFooWithParameters(a, b);
private privateFooWithRestParameters(a, ...rests);
private privateFooWithOverloads(a);
private privateFooWithOverloads(a);
private privateFooWithOverloads(a);
static staticFoo();
static staticFooWithParameters(a, b);
static staticFooWithRestParameters(a, ...rests);
static staticFooWithOverloads(a);
static staticFooWithOverloads(a);
static staticFooWithOverloads(a);
private static privateStaticFoo();
private static privateStaticFooWithParameters(a, b);
private static privateStaticFooWithRestParameters(a, ...rests);
private static privateStaticFooWithOverloads(a);
private static privateStaticFooWithOverloads(a);
private static privateStaticFooWithOverloads(a);
}
interface I2 {
foo();
fooWithParameters(a, b);
fooWithRestParameters(a, ...rests);
fooWithOverloads(a);
fooWithOverloads(a);
}
@@ -26,3 +26,8 @@ var d = {
//// [declFileModuleAssignmentInObjectLiteralProperty.d.ts]
declare module m1 {
class c {
}
}
declare var d;
@@ -28,3 +28,11 @@ var A;
//// [declFileModuleContinuation.d.ts]
declare module A.C {
interface Z {
}
}
declare module A.B.C {
class W implments A.C.Z {
}
}
@@ -21,3 +21,8 @@ var m;
//// [declFileModuleWithPropertyOfTypeModule.d.ts]
declare module m {
class c {
}
var a;
}
@@ -8,3 +8,6 @@ interface X {
//// [declFileOptionalInterfaceMethod.d.ts]
interface X {
f?<T>();
}
@@ -11,3 +11,4 @@ var n = { w: null, x: '', y: function () {
//// [declFileRegressionTests.d.ts]
declare var n;
@@ -31,3 +31,9 @@ var f6 = function () {
//// [declFileRestParametersOfFunctionAndFunctionType.d.ts]
declare function f1(...args);
declare function f2(x);
declare function f3(x);
declare function f4<T extends (...args) => void>();
declare function f5<T extends { (...args): void }>();
declare var f6;
@@ -34,3 +34,15 @@ var genericX = genericC;
//// [declFileTypeofClass.d.ts]
declare class c {
static x;
private static y;
private x3;
y3;
}
declare var x;
declare var y;
declare var z;
declare class genericC<T> {
}
declare var genericX;
@@ -31,3 +31,15 @@ var daysOfYear;
//// [declFileTypeofEnum.d.ts]
declare enum days {
monday = 0,
tuesday = 1,
wednesday = 2,
thursday = 3,
friday = 4,
saturday = 5,
sunday = 6,
}
declare var weekendDay;
declare var daysOfMonth;
declare var daysOfYear;
@@ -64,3 +64,17 @@ function foo5(x) {
//// [declFileTypeofFunction.d.ts]
declare function f(n);
declare function f(n);
declare function f();
declare function g(n);
declare function g(n);
declare function g();
declare var b;
declare function b1();
declare function foo();
declare var foo1;
declare var foo2;
declare var foo3;
declare var x;
declare function foo5(x);
@@ -53,3 +53,16 @@ var d = {
//// [declFileTypeofInAnonymousType.d.ts]
declare module m1 {
class c {
}
enum e {
weekday = 0,
weekend = 1,
holiday = 2,
}
}
declare var a;
declare var b;
declare var c;
declare var d;
@@ -29,3 +29,13 @@ var m2_2;
//// [declFileTypeofModule.d.ts]
declare module m1 {
var c;
}
declare var m1_1;
declare var m1_2;
declare module m2 {
var d;
}
declare var m2_1;
declare var m2_2;
@@ -67,3 +67,18 @@ var X;
//// [declFileWithClassNameConflictingWithClassReferredByExtendsClause.d.ts]
declare module A.B.Base {
class W {
id;
}
}
declare module X.Y.base {
class W extends A.B.Base.W {
name;
}
}
declare module X.Y.base.Z {
class W<TValue> extends X.Y.base.W {
value;
}
}
@@ -57,3 +57,15 @@ var A;
//// [declFileWithExtendsClauseThatHasItsContainerNameConflict.d.ts]
declare module A.B.C {
}
declare module A.B {
class EventManager {
id;
}
}
declare module A.B.C {
class ContextMenu extends EventManager {
name;
}
}
@@ -33,3 +33,11 @@ var X;
//// [declFileWithInternalModuleNameConflictsInExtendsClause1.d.ts]
declare module X.A.C {
interface Z {
}
}
declare module X.A.B.C {
class W implments X.A.C.Z {
}
}
@@ -36,3 +36,13 @@ var X;
//// [declFileWithInternalModuleNameConflictsInExtendsClause2.d.ts]
declare module X.A.C {
interface Z {
}
}
declare module X.A.B.C {
class W implments A.C.Z {
}
}
declare module X.A.B.C {
}
@@ -36,3 +36,15 @@ var X;
//// [declFileWithInternalModuleNameConflictsInExtendsClause3.d.ts]
declare module X.A.C {
interface Z {
}
}
declare module X.A.B.C {
class W implments X.A.C.Z {
}
}
declare module X.A.B.C {
module A {
}
}
+21
View File
@@ -61,3 +61,24 @@ var M;
//// [declInput-2.d.ts]
declare module M {
class E {
}
interface I1 {
}
class D {
private c;
m1;
m2;
m22;
m23;
m24;
m25;
m232();
m242();
m252();
m26(i);
m262(i);
m3();
}
}
+7
View File
@@ -31,3 +31,10 @@ var bar = (function () {
//// [declInput3.d.ts]
interface bar2 {
}
declare class bar {
f();
g();
h(x?, y?, z?);
}
+15
View File
@@ -47,3 +47,18 @@ var M;
//// [declInput4.d.ts]
declare module M {
class E {
}
interface I1 {
}
class D {
m1;
m2;
m23;
m24;
m232();
m242();
m26(i);
}
}
@@ -6,3 +6,5 @@ interface A extends Array<string> { }
//// [declarationEmit_array-types-from-generic-array-usage.d.ts]
interface A extends Array<string> {
}
@@ -61,3 +61,19 @@ var X;
//// [declarationEmit_nameConflicts2.d.ts]
declare module X.Y.base {
function f();
class C {
}
module M {
var v;
}
enum E {
}
}
declare module X.Y.base.Z {
var f;
var C;
var M;
var E;
}
@@ -88,3 +88,30 @@ var M;
//// [declarationEmit_nameConflicts3.d.ts]
declare module M {
interface D {
}
module D {
function f();
}
module C {
function f();
}
module E {
function f();
}
}
declare module M.P {
class C {
static f();
}
class E extends C {
}
enum D {
f = 0,
}
var v;
var w;
var x;
var x;
}
@@ -14,3 +14,11 @@ module T.U { // This needs to be emitted
//// [declareDottedModuleName.d.ts]
declare module M {
}
declare module M {
module R.S {
}
}
declare module T.U {
}
+2
View File
@@ -13,3 +13,5 @@ declare module mAmbient {
//// [enumDecl1.d.ts]
declare module mAmbient {
}
+4
View File
@@ -25,3 +25,7 @@ var A = (function () {
//# sourceMappingURL=es3-amd.js.map
//// [es3-amd.d.ts]
declare class A {
constructor ();
B();
}
@@ -25,3 +25,7 @@ var A = (function () {
//# sourceMappingURL=es3-declaration-amd.js.map
//// [es3-declaration-amd.d.ts]
declare class A {
constructor ();
B();
}
+4
View File
@@ -25,3 +25,7 @@ var A = (function () {
//# sourceMappingURL=es5-amd.js.map
//// [es5-amd.d.ts]
declare class A {
constructor ();
B();
}
@@ -25,3 +25,7 @@ var A = (function () {
//# sourceMappingURL=es5-declaration-amd.js.map
//// [es5-declaration-amd.d.ts]
declare class A {
constructor ();
B();
}
+30
View File
@@ -133,3 +133,33 @@ var f2 = function () {
//// [funcdecl.d.ts]
declare function simpleFunc();
declare var simpleFuncVar;
declare function anotherFuncNoReturn();
declare var anotherFuncNoReturnVar;
declare function withReturn();
declare var withReturnVar;
declare function withParams(a);
declare var withparamsVar;
declare function withMultiParams(a, b, c);
declare var withMultiParamsVar;
declare function withOptionalParams(a?);
declare var withOptionalParamsVar;
declare function withInitializedParams(a, b0, b?, c?);
declare var withInitializedParamsVar;
declare function withOptionalInitializedParams(a, c?);
declare var withOptionalInitializedParamsVar;
declare function withRestParams(a, ...myRestParameter);
declare var withRestParamsVar;
declare function overload1(n);
declare function overload1(s);
declare function overload1(ns);
declare var withOverloadSignature;
declare function f(n);
declare module m2 {
function foo(n);
}
declare function fooAmbient(n);
declare function overloadAmbient(n);
declare function overloadAmbient(s);
declare var f2;
@@ -11,3 +11,4 @@ function foo(args) {
//// [functionDeclarationWithArgumentOfTypeFunctionTypeArray.d.ts]
declare function foo(args);
@@ -8,3 +8,4 @@ var x = function somefn() {
//// [functionExpressionReturningItself.d.ts]
declare var x;
@@ -10,3 +10,4 @@ function somefn() {
//// [functionReturningItself.d.ts]
declare function somefn();
@@ -20,3 +20,6 @@ function map() {
//// [genericArray0.d.ts]
declare var x;
declare var y;
declare function map<U>();
@@ -19,3 +19,4 @@ var lengths = ["a", "b", "c"].map(function (x) { return x.length; });
//// [genericArray1.d.ts]
declare var lengths;
@@ -20,3 +20,11 @@ var bar;
//// [genericClassImplementingGenericInterfaceFromAnotherModule.d.ts]
declare module foo {
interface IFoo<T> {
}
}
declare module bar {
class Foo<T> implments foo.IFoo<T> {
}
}
@@ -18,3 +18,8 @@ var y = v1.x;
//// [genericClasses0.d.ts]
declare class C<T> {
x;
}
declare var v1;
declare var y;
@@ -18,3 +18,8 @@ var y = v1.x;
//// [genericClasses1.d.ts]
declare class C<T> {
x;
}
declare var v1;
declare var y;
@@ -28,3 +28,15 @@ var z = v1.z.a;
//// [genericClasses2.d.ts]
interface Foo<T> {
a;
}
declare class C<T> {
x;
y;
z;
}
declare var v1;
declare var y;
declare var w;
declare var z;
@@ -43,3 +43,14 @@ var z = v2.b;
//// [genericClasses3.d.ts]
declare class B<T> {
a;
b;
}
declare class C<T> extends B<T> {
x;
}
declare var v2;
declare var y;
declare var u;
declare var z;
@@ -29,3 +29,10 @@ var a = new Foo.B();
//// [genericClassesInModule.d.ts]
declare module Foo {
class B<T> {
}
class A {
}
}
declare var a;
@@ -20,3 +20,6 @@ var List = (function () {
//// [genericConstraintDeclaration.d.ts]
declare class List<T extends {}> {
static empty<T extends {}>();
}
@@ -11,3 +11,5 @@ var x = foo(5);
//// [genericFunctions0.d.ts]
declare function foo<T>(x);
declare var x;
@@ -11,3 +11,5 @@ var x = foo(5);
//// [genericFunctions1.d.ts]
declare function foo<T>(x);
declare var x;
@@ -12,3 +12,6 @@ var lengths = map(myItems, function (x) { return x.length; });
//// [genericFunctions2.d.ts]
declare function map<T, U>(items, f);
declare var myItems;
declare var lengths;
+5
View File
@@ -13,3 +13,8 @@ var z = v2.x;
//// [generics0.d.ts]
interface G<T> {
x;
}
declare var v2;
declare var z;
@@ -17,3 +17,19 @@ var v4;
//// [generics1NoError.d.ts]
interface A {
a;
}
interface B extends A {
b;
}
interface C extends B {
c;
}
interface G<T, U extends B> {
x;
y;
}
declare var v1;
declare var v2;
declare var v4;
@@ -24,3 +24,19 @@ var v4;
//// [generics2NoError.d.ts]
interface A {
a;
}
interface B extends A {
b;
}
interface C extends B {
c;
}
interface G<T, U extends B> {
x;
y;
}
declare var v1;
declare var v2;
declare var v4;
+11
View File
@@ -19,3 +19,14 @@ a = b;
//// [generics3.d.ts]
declare class C<T> {
private x;
}
interface X {
f();
}
interface Y {
f();
}
declare var a;
declare var b;
@@ -17,3 +17,14 @@ var b;
//// [generics4NoError.d.ts]
declare class C<T> {
private x;
}
interface X {
f();
}
interface Y {
f();
}
declare var a;
declare var b;
@@ -43,3 +43,9 @@ var C = (function () {
//// [implicitAnyAnyReturningFunction.d.ts]
declare function A();
declare function B();
declare class C {
A();
B();
}
@@ -32,3 +32,6 @@ function fn3() {
//// [implicitAnyDeclareFunctionWithoutFormalType2.d.ts]
declare function fn1();
declare function fn2();
declare function fn3();
@@ -8,3 +8,7 @@ interface foo {
//// [interfaceOnly.d.ts]
interface foo {
foo();
f2(f);
}
@@ -8,3 +8,6 @@ interface I {
//// [interfaceWithOptionalProperty.d.ts]
interface I {
x?;
}
@@ -56,3 +56,37 @@ var instance2 = new c1();
//// [interfacedecl.d.ts]
interface a0 {
();
(a, b, c?);
new ();
new (s);
[n];
[s];
p1;
p2;
p3?;
p4?;
p5;
f1();
f2?();
f3(a);
f4?(s);
}
interface a1 {
[n];
}
interface a2 {
[s];
}
interface a {
}
interface b extends a {
}
interface c extends a, b {
}
interface d extends a {
}
declare class c1 implments a {
}
declare var instance2;
@@ -27,3 +27,10 @@ var c;
//// [internalAliasClass.d.ts]
declare module a {
class c {
}
}
declare module c {
var x;
}
@@ -52,7 +52,6 @@ export declare module m2 {
module m3 {
export import c = x.c;
var cProp;
var cReturnVal;
}
}
export declare var d;
@@ -48,6 +48,5 @@ export declare module x {
export declare module m2 {
module m3 {
var cProp;
var cReturnVal;
}
}
@@ -31,3 +31,13 @@ var c;
//// [internalAliasEnum.d.ts]
declare module a {
enum weekend {
Friday = 0,
Saturday = 1,
Sunday = 2,
}
}
declare module c {
var bVal;
}
@@ -29,3 +29,10 @@ var c;
//// [internalAliasFunction.d.ts]
declare module a {
function foo(x);
}
declare module c {
var bVal;
var bVal2;
}
@@ -33,6 +33,5 @@ export declare module a {
function foo(x);
}
export declare module c {
var bVal;
var bVal2;
}
@@ -32,3 +32,12 @@ var c;
//// [internalAliasInitializedModule.d.ts]
declare module a {
module b {
class c {
}
}
}
declare module c {
var x;
}

Some files were not shown because too many files have changed in this diff Show More