-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix decorator metadata references to type-only-imported namespaces (#…
…44915) * Add test * Fix metadata references to type-only-imported namespaces * Use `!!` instead of `|| false`
- Loading branch information
1 parent
7669bfb
commit bfd5b2f
Showing
5 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
53 changes: 53 additions & 0 deletions
53
tests/baselines/reference/decoratorMetadataWithTypeOnlyImport2.js
This file contains 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,53 @@ | ||
//// [tests/cases/conformance/decorators/decoratorMetadataWithTypeOnlyImport2.ts] //// | ||
|
||
//// [services.ts] | ||
export namespace Services { | ||
export class Service {} | ||
} | ||
|
||
//// [index.ts] | ||
import type { Services } from './services'; | ||
|
||
declare const decorator: any; | ||
export class Main { | ||
@decorator() | ||
field: Services.Service; | ||
} | ||
|
||
|
||
//// [services.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.Services = void 0; | ||
var Services; | ||
(function (Services) { | ||
var Service = /** @class */ (function () { | ||
function Service() { | ||
} | ||
return Service; | ||
}()); | ||
Services.Service = Service; | ||
})(Services = exports.Services || (exports.Services = {})); | ||
//// [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); | ||
}; | ||
exports.__esModule = true; | ||
exports.Main = void 0; | ||
var Main = /** @class */ (function () { | ||
function Main() { | ||
} | ||
__decorate([ | ||
decorator(), | ||
__metadata("design:type", Function) | ||
], Main.prototype, "field"); | ||
return Main; | ||
}()); | ||
exports.Main = Main; |
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/decoratorMetadataWithTypeOnlyImport2.symbols
This file contains 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/conformance/decorators/services.ts === | ||
export namespace Services { | ||
>Services : Symbol(Services, Decl(services.ts, 0, 0)) | ||
|
||
export class Service {} | ||
>Service : Symbol(Service, Decl(services.ts, 0, 27)) | ||
} | ||
|
||
=== tests/cases/conformance/decorators/index.ts === | ||
import type { Services } from './services'; | ||
>Services : Symbol(Services, Decl(index.ts, 0, 13)) | ||
|
||
declare const decorator: any; | ||
>decorator : Symbol(decorator, Decl(index.ts, 2, 13)) | ||
|
||
export class Main { | ||
>Main : Symbol(Main, Decl(index.ts, 2, 29)) | ||
|
||
@decorator() | ||
>decorator : Symbol(decorator, Decl(index.ts, 2, 13)) | ||
|
||
field: Services.Service; | ||
>field : Symbol(Main.field, Decl(index.ts, 3, 19)) | ||
>Services : Symbol(Services, Decl(index.ts, 0, 13)) | ||
>Service : Symbol(Services.Service, Decl(services.ts, 0, 27)) | ||
} | ||
|
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/decoratorMetadataWithTypeOnlyImport2.types
This file contains 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/conformance/decorators/services.ts === | ||
export namespace Services { | ||
>Services : typeof Services | ||
|
||
export class Service {} | ||
>Service : Service | ||
} | ||
|
||
=== tests/cases/conformance/decorators/index.ts === | ||
import type { Services } from './services'; | ||
>Services : any | ||
|
||
declare const decorator: any; | ||
>decorator : any | ||
|
||
export class Main { | ||
>Main : Main | ||
|
||
@decorator() | ||
>decorator() : any | ||
>decorator : any | ||
|
||
field: Services.Service; | ||
>field : Services.Service | ||
>Services : any | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
tests/cases/conformance/decorators/decoratorMetadataWithTypeOnlyImport2.ts
This file contains 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,17 @@ | ||
// @experimentalDecorators: true | ||
// @emitDecoratorMetadata: true | ||
|
||
|
||
// @filename: services.ts | ||
export namespace Services { | ||
export class Service {} | ||
} | ||
|
||
// @filename: index.ts | ||
import type { Services } from './services'; | ||
|
||
declare const decorator: any; | ||
export class Main { | ||
@decorator() | ||
field: Services.Service; | ||
} |