Skip to content

Commit 0a535f0

Browse files
authored
Merge pull request #13585 from Microsoft/Fix14036
Fix DefinitelyTyped/DefinitelyTyped#14036
2 parents 2c48e26 + d11d03a commit 0a535f0

File tree

4 files changed

+81
-1
lines changed

4 files changed

+81
-1
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4172,7 +4172,6 @@ namespace ts {
41724172
}
41734173

41744174
function getDeclaredTypeOfSymbol(symbol: Symbol): Type {
4175-
Debug.assert((symbol.flags & SymbolFlags.Instantiated) === 0);
41764175
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
41774176
return getDeclaredTypeOfClassOrInterface(symbol);
41784177
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
tests/cases/compiler/test.ts(4,5): error TS2322: Type 'PassportStatic' is not assignable to type 'Passport'.
2+
Types of property 'use' are incompatible.
3+
Type '() => PassportStatic' is not assignable to type '() => this'.
4+
Type 'PassportStatic' is not assignable to type 'this'.
5+
6+
7+
==== tests/cases/compiler/passport.d.ts (0 errors) ====
8+
declare module 'passport' {
9+
namespace passport {
10+
interface Passport {
11+
use(): this;
12+
}
13+
14+
interface PassportStatic extends Passport {
15+
Passport: {new(): Passport};
16+
}
17+
}
18+
19+
const passport: passport.PassportStatic;
20+
export = passport;
21+
}
22+
23+
==== tests/cases/compiler/test.ts (1 errors) ====
24+
import * as passport from "passport";
25+
import { Passport } from "passport";
26+
27+
let p: Passport = passport.use();
28+
~
29+
!!! error TS2322: Type 'PassportStatic' is not assignable to type 'Passport'.
30+
!!! error TS2322: Types of property 'use' are incompatible.
31+
!!! error TS2322: Type '() => PassportStatic' is not assignable to type '() => this'.
32+
!!! error TS2322: Type 'PassportStatic' is not assignable to type 'this'.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//// [tests/cases/compiler/mergedDeclarations7.ts] ////
2+
3+
//// [passport.d.ts]
4+
declare module 'passport' {
5+
namespace passport {
6+
interface Passport {
7+
use(): this;
8+
}
9+
10+
interface PassportStatic extends Passport {
11+
Passport: {new(): Passport};
12+
}
13+
}
14+
15+
const passport: passport.PassportStatic;
16+
export = passport;
17+
}
18+
19+
//// [test.ts]
20+
import * as passport from "passport";
21+
import { Passport } from "passport";
22+
23+
let p: Passport = passport.use();
24+
25+
//// [test.js]
26+
"use strict";
27+
var passport = require("passport");
28+
var p = passport.use();
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// @filename: passport.d.ts
2+
declare module 'passport' {
3+
namespace passport {
4+
interface Passport {
5+
use(): this;
6+
}
7+
8+
interface PassportStatic extends Passport {
9+
Passport: {new(): Passport};
10+
}
11+
}
12+
13+
const passport: passport.PassportStatic;
14+
export = passport;
15+
}
16+
17+
//@filename: test.ts
18+
import * as passport from "passport";
19+
import { Passport } from "passport";
20+
21+
let p: Passport = passport.use();

0 commit comments

Comments
 (0)