-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Don't skip markLinkedReferences on ambient properties #59325
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tests/baselines/reference/decoratorMetadataElidedImportOnDeclare(module=commonjs).js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//// [tests/cases/compiler/decoratorMetadataElidedImportOnDeclare.ts] //// | ||
|
||
//// [observable.d.ts] | ||
export declare class Observable<T> {} | ||
|
||
//// [index.ts] | ||
import { Observable } from './observable'; | ||
|
||
function whatever(a: any, b: any) {} | ||
|
||
class Test { | ||
@whatever | ||
declare prop: Observable<string>; | ||
} | ||
|
||
|
||
//// [index.js] | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const observable_1 = require("./observable"); | ||
function whatever(a, b) { } | ||
class Test { | ||
} | ||
__decorate([ | ||
whatever, | ||
__metadata("design:type", observable_1.Observable) | ||
], Test.prototype, "prop", void 0); |
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/decoratorMetadataElidedImportOnDeclare(module=commonjs).symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//// [tests/cases/compiler/decoratorMetadataElidedImportOnDeclare.ts] //// | ||
|
||
=== observable.d.ts === | ||
export declare class Observable<T> {} | ||
>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 0)) | ||
>T : Symbol(T, Decl(observable.d.ts, 0, 32)) | ||
|
||
=== index.ts === | ||
import { Observable } from './observable'; | ||
>Observable : Symbol(Observable, Decl(index.ts, 0, 8)) | ||
|
||
function whatever(a: any, b: any) {} | ||
>whatever : Symbol(whatever, Decl(index.ts, 0, 42)) | ||
>a : Symbol(a, Decl(index.ts, 2, 18)) | ||
>b : Symbol(b, Decl(index.ts, 2, 25)) | ||
|
||
class Test { | ||
>Test : Symbol(Test, Decl(index.ts, 2, 36)) | ||
|
||
@whatever | ||
>whatever : Symbol(whatever, Decl(index.ts, 0, 42)) | ||
|
||
declare prop: Observable<string>; | ||
>prop : Symbol(Test.prop, Decl(index.ts, 4, 12)) | ||
>Observable : Symbol(Observable, Decl(index.ts, 0, 8)) | ||
} | ||
|
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/decoratorMetadataElidedImportOnDeclare(module=commonjs).types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//// [tests/cases/compiler/decoratorMetadataElidedImportOnDeclare.ts] //// | ||
|
||
=== observable.d.ts === | ||
export declare class Observable<T> {} | ||
>Observable : Observable<T> | ||
> : ^^^^^^^^^^^^^ | ||
|
||
=== index.ts === | ||
import { Observable } from './observable'; | ||
>Observable : typeof Observable | ||
> : ^^^^^^^^^^^^^^^^^ | ||
|
||
function whatever(a: any, b: any) {} | ||
>whatever : (a: any, b: any) => void | ||
> : ^ ^^ ^^ ^^ ^^^^^^^^^ | ||
>a : any | ||
>b : any | ||
|
||
class Test { | ||
>Test : Test | ||
> : ^^^^ | ||
|
||
@whatever | ||
>whatever : (a: any, b: any) => void | ||
> : ^ ^^ ^^ ^^ ^^^^^^^^^ | ||
|
||
declare prop: Observable<string>; | ||
>prop : Observable<string> | ||
> : ^^^^^^^^^^^^^^^^^^ | ||
} | ||
|
34 changes: 34 additions & 0 deletions
34
tests/baselines/reference/decoratorMetadataElidedImportOnDeclare(module=esnext).js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//// [tests/cases/compiler/decoratorMetadataElidedImportOnDeclare.ts] //// | ||
|
||
//// [observable.d.ts] | ||
export declare class Observable<T> {} | ||
|
||
//// [index.ts] | ||
import { Observable } from './observable'; | ||
|
||
function whatever(a: any, b: any) {} | ||
|
||
class Test { | ||
@whatever | ||
declare prop: Observable<string>; | ||
} | ||
|
||
|
||
//// [index.js] | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
import { Observable } from './observable'; | ||
function whatever(a, b) { } | ||
class Test { | ||
} | ||
__decorate([ | ||
whatever, | ||
__metadata("design:type", Observable) | ||
], Test.prototype, "prop", void 0); |
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/decoratorMetadataElidedImportOnDeclare(module=esnext).symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//// [tests/cases/compiler/decoratorMetadataElidedImportOnDeclare.ts] //// | ||
|
||
=== observable.d.ts === | ||
export declare class Observable<T> {} | ||
>Observable : Symbol(Observable, Decl(observable.d.ts, 0, 0)) | ||
>T : Symbol(T, Decl(observable.d.ts, 0, 32)) | ||
|
||
=== index.ts === | ||
import { Observable } from './observable'; | ||
>Observable : Symbol(Observable, Decl(index.ts, 0, 8)) | ||
|
||
function whatever(a: any, b: any) {} | ||
>whatever : Symbol(whatever, Decl(index.ts, 0, 42)) | ||
>a : Symbol(a, Decl(index.ts, 2, 18)) | ||
>b : Symbol(b, Decl(index.ts, 2, 25)) | ||
|
||
class Test { | ||
>Test : Symbol(Test, Decl(index.ts, 2, 36)) | ||
|
||
@whatever | ||
>whatever : Symbol(whatever, Decl(index.ts, 0, 42)) | ||
|
||
declare prop: Observable<string>; | ||
>prop : Symbol(Test.prop, Decl(index.ts, 4, 12)) | ||
>Observable : Symbol(Observable, Decl(index.ts, 0, 8)) | ||
} | ||
|
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/decoratorMetadataElidedImportOnDeclare(module=esnext).types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//// [tests/cases/compiler/decoratorMetadataElidedImportOnDeclare.ts] //// | ||
|
||
=== observable.d.ts === | ||
export declare class Observable<T> {} | ||
>Observable : Observable<T> | ||
> : ^^^^^^^^^^^^^ | ||
|
||
=== index.ts === | ||
import { Observable } from './observable'; | ||
>Observable : typeof Observable | ||
> : ^^^^^^^^^^^^^^^^^ | ||
|
||
function whatever(a: any, b: any) {} | ||
>whatever : (a: any, b: any) => void | ||
> : ^ ^^ ^^ ^^ ^^^^^^^^^ | ||
>a : any | ||
>b : any | ||
|
||
class Test { | ||
>Test : Test | ||
> : ^^^^ | ||
|
||
@whatever | ||
>whatever : (a: any, b: any) => void | ||
> : ^ ^^ ^^ ^^ ^^^^^^^^^ | ||
|
||
declare prop: Observable<string>; | ||
>prop : Observable<string> | ||
> : ^^^^^^^^^^^^^^^^^^ | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
tests/cases/compiler/decoratorMetadataElidedImportOnDeclare.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// @target: es2020 | ||
// @module: commonjs, esnext | ||
// @strict: true | ||
// @experimentalDecorators: true | ||
// @emitDecoratorMetadata: true | ||
|
||
// @filename: observable.d.ts | ||
export declare class Observable<T> {} | ||
|
||
// @filename: index.ts | ||
import { Observable } from './observable'; | ||
|
||
function whatever(a: any, b: any) {} | ||
|
||
class Test { | ||
@whatever | ||
declare prop: Observable<string>; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Yeah, I wouldn't want to remove this outright - perf tests won't show it, but this is pretty important to keep this fast from my testing. I'd just except ambient property signatures from the early skip, since they're like... not really ambient? It looks like when we have something like
the
prop
is ambient marked, but the decorator is not, so we should just be able to except the prop, like @rbuckton says.seems like it aughta work?
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.
Done; that seemed to be enough.
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.
declare
fields aren't quite as ambient as other declarations. They were added as a compatiblity mechanism due to native class fields using Define semantics, with legacy decorators being one of the main motivations.