Remove assert.
This commit is contained in:
Mohamed Hegazy 2017-01-19 17:36:16 -08:00
parent 2c48e26f19
commit d11d03a06c
4 changed files with 81 additions and 1 deletions

View File

@ -4172,7 +4172,6 @@ namespace ts {
}
function getDeclaredTypeOfSymbol(symbol: Symbol): Type {
Debug.assert((symbol.flags & SymbolFlags.Instantiated) === 0);
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
return getDeclaredTypeOfClassOrInterface(symbol);
}

View File

@ -0,0 +1,32 @@
tests/cases/compiler/test.ts(4,5): error TS2322: Type 'PassportStatic' is not assignable to type 'Passport'.
Types of property 'use' are incompatible.
Type '() => PassportStatic' is not assignable to type '() => this'.
Type 'PassportStatic' is not assignable to type 'this'.
==== tests/cases/compiler/passport.d.ts (0 errors) ====
declare module 'passport' {
namespace passport {
interface Passport {
use(): this;
}
interface PassportStatic extends Passport {
Passport: {new(): Passport};
}
}
const passport: passport.PassportStatic;
export = passport;
}
==== tests/cases/compiler/test.ts (1 errors) ====
import * as passport from "passport";
import { Passport } from "passport";
let p: Passport = passport.use();
~
!!! error TS2322: Type 'PassportStatic' is not assignable to type 'Passport'.
!!! error TS2322: Types of property 'use' are incompatible.
!!! error TS2322: Type '() => PassportStatic' is not assignable to type '() => this'.
!!! error TS2322: Type 'PassportStatic' is not assignable to type 'this'.

View File

@ -0,0 +1,28 @@
//// [tests/cases/compiler/mergedDeclarations7.ts] ////
//// [passport.d.ts]
declare module 'passport' {
namespace passport {
interface Passport {
use(): this;
}
interface PassportStatic extends Passport {
Passport: {new(): Passport};
}
}
const passport: passport.PassportStatic;
export = passport;
}
//// [test.ts]
import * as passport from "passport";
import { Passport } from "passport";
let p: Passport = passport.use();
//// [test.js]
"use strict";
var passport = require("passport");
var p = passport.use();

View File

@ -0,0 +1,21 @@
// @filename: passport.d.ts
declare module 'passport' {
namespace passport {
interface Passport {
use(): this;
}
interface PassportStatic extends Passport {
Passport: {new(): Passport};
}
}
const passport: passport.PassportStatic;
export = passport;
}
//@filename: test.ts
import * as passport from "passport";
import { Passport } from "passport";
let p: Passport = passport.use();