Skip to content

Angular Compiler CLI: typescript types being emitted in exports in metadata.json rather than originsΒ #18675

@alan-agius4

Description

@alan-agius4

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Looks like types are being exported differently depending on the content of the file if it contains a model it will be appended to origins will if not it will be in exports

Expected behavior

same output

What is the motivation / use case for changing the behavior?

Looks like types are being exported differently depending on the content of the file

model.ts

export type MyTypeSecondary = "a" | "b";

export interface MyInterface {
	key: MyTypeSecondary;
}

type.ts

export type MyType = "a" | "b";

index.ts

export { MyType }  from "./type";
export { MyTypeSecondary }  from "./model";

outputted
index.metadata.json

{
	"__symbolic": "module",
	"version": 3,
	"exports": [
		{
			"export": [
				{
					"name": "MyType",
					"as": "MyType"
				}
			],
			"from": "./type"
		}
	],
	"metadata": {},
	"origins": {
		"MyTypeSecondary": "./model"
	},
	"importAs": "mylibrary"
}

in the ngfactory then i can see that the type are being exported also, which I doubt that it should be the case.

Angular Compiler CLI 4.3.4

I have also created a repo to demonstrate this issue: https://github.com/alan-agius4/angular-aot-metadata-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions