- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
Allow expressions in class extends clauses #3516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dfa1494
              80ea687
              956d73e
              cc81cc7
              367e257
              d575259
              186f525
              e305de1
              d09d61f
              de8eb22
              38e3d9f
              2c57776
              f6bcf70
              d71af8a
              471f6e0
              efcccaa
              26fd879
              5b9a1b5
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -1669,10 +1669,8 @@ namespace ts { | |
| typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic) | ||
| outerTypeParameters: TypeParameter[]; // Outer type parameters (undefined if none) | ||
| localTypeParameters: TypeParameter[]; // Local type parameters (undefined if none) | ||
| } | ||
|  | ||
| export interface InterfaceTypeWithBaseTypes extends InterfaceType { | ||
| baseTypes: ObjectType[]; | ||
| resolvedBaseConstructorType?: Type; // Resolved base constructor type of class | ||
| resolvedBaseTypes: ObjectType[]; // Resolved base types | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't these still need to be deferred until after getDeclaredTypeOfSymbol? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In other words, why remove InterfaceWithBaseTypes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, they're still deferred. The pattern we use elsewhere for single deferred values is a resolvedXXX property guarded by a getXXX function that returns the value. In cases where we defer the computation of multiple properties we use an XXXWithYYY type and return the object itself. | ||
| } | ||
|  | ||
| export interface InterfaceTypeWithDeclaredMembers extends InterfaceType { | ||
|  | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| === tests/cases/compiler/checkForObjectTooStrict.ts === | ||
| module Foo { | ||
| >Foo : Symbol(Foo, Decl(checkForObjectTooStrict.ts, 0, 0)) | ||
|  | ||
| export class Object { | ||
| >Object : Symbol(Object, Decl(checkForObjectTooStrict.ts, 0, 12)) | ||
|  | ||
| } | ||
|  | ||
| } | ||
|  | ||
|  | ||
|  | ||
| class Bar extends Foo.Object { // should work | ||
| >Bar : Symbol(Bar, Decl(checkForObjectTooStrict.ts, 6, 1)) | ||
| >Foo.Object : Symbol(Foo.Object, Decl(checkForObjectTooStrict.ts, 0, 12)) | ||
| >Foo : Symbol(Foo, Decl(checkForObjectTooStrict.ts, 0, 0)) | ||
| >Object : Symbol(Foo.Object, Decl(checkForObjectTooStrict.ts, 0, 12)) | ||
|  | ||
| constructor () { | ||
|  | ||
| super(); | ||
| >super : Symbol(Foo.Object, Decl(checkForObjectTooStrict.ts, 0, 12)) | ||
|  | ||
| } | ||
|  | ||
| } | ||
|  | ||
|  | ||
| class Baz extends Object { | ||
| >Baz : Symbol(Baz, Decl(checkForObjectTooStrict.ts, 18, 1)) | ||
| >Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11)) | ||
|  | ||
| constructor () { // ERROR, as expected | ||
|  | ||
| super(); | ||
| >super : Symbol(ObjectConstructor, Decl(lib.d.ts, 124, 1)) | ||
|  | ||
| } | ||
|  | ||
| } | ||
|  | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| === tests/cases/compiler/checkForObjectTooStrict.ts === | ||
| module Foo { | ||
| >Foo : typeof Foo | ||
|  | ||
| export class Object { | ||
| >Object : Object | ||
|  | ||
| } | ||
|  | ||
| } | ||
|  | ||
|  | ||
|  | ||
| class Bar extends Foo.Object { // should work | ||
| >Bar : Bar | ||
| >Foo.Object : Foo.Object | ||
| >Foo : typeof Foo | ||
| >Object : typeof Foo.Object | ||
|  | ||
| constructor () { | ||
|  | ||
| super(); | ||
| >super() : void | ||
| >super : typeof Foo.Object | ||
|  | ||
| } | ||
|  | ||
| } | ||
|  | ||
|  | ||
| class Baz extends Object { | ||
| >Baz : Baz | ||
| >Object : Object | ||
|  | ||
| constructor () { // ERROR, as expected | ||
|  | ||
| super(); | ||
| >super() : void | ||
| >super : ObjectConstructor | ||
|  | ||
| } | ||
|  | ||
| } | ||
|  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be helpful in these 4 error messages to mention what type the expression resolved to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, at least for the first and the third message.