fix(compiler): handle ambient types in input transform function#51474
fix(compiler): handle ambient types in input transform function#51474crisbeto wants to merge 4 commits intoangular:mainangular/angular:mainfrom crisbeto:51424/input-transform-ambientcrisbeto/angular:51424/input-transform-ambientCopy head branch name to clipboard
Conversation
7d90aaa to
bc1869f
Compare
There was a problem hiding this comment.
Context here: in #43511 we added some assertions around not allowing classes defined inside namespaces. I added this flag so we only allow ambient references in specific places (input transforms in this case).
There was a problem hiding this comment.
I can't think of a reason why we wouldn't want this behavior if AllowTypeImports is used; can the new condition just use the AllowTypeImports flag instead of introducing a new mode?
There was a problem hiding this comment.
It looks like using AllowTypeImports also allows the behavior we were guarding against in #43511.
There was a problem hiding this comment.
That is somewhat unexpected to me 🤔
There was a problem hiding this comment.
Unrelated to these changes, but this code explains #51190 (comment); the logic here should probably be updated to adopt the TypeEmitter/TypeParameterEmitter since it has some more logic to properly transplant literal types, which is currently broken for input transform transplantations.
There was a problem hiding this comment.
👍 I think we should tackle #51190 (comment) separately though. I'll add it to my list.
There was a problem hiding this comment.
I can't think of a reason why we wouldn't want this behavior if AllowTypeImports is used; can the new condition just use the AllowTypeImports flag instead of introducing a new mode?
8123740 to
27441b6
Compare
|
@JoostK I got some time to revisit this PR. I've pushed the changes from #51474 (comment) in the |
27441b6 to
f791469
Compare
packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.ts
Outdated
Show resolved
Hide resolved
f791469 to
f577189
Compare
|
@JoostK I've addressed 2/3 latest comments and responded on the other one. |
Fixes that the compiler was throwing an error if an ambient type is used inside of an input `transform` function. The problem was that the reference emitter was trying to write a reference to the ambient type's source file which isn't necessary. Fixes angular#51424.
f577189 to
b932505
Compare
|
Addressed the last comment. The changes are in the final |
b932505 to
83b6348
Compare
|
This PR was merged into the repository by commit b98d8f7. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…lar#51474) Fixes that the compiler was throwing an error if an ambient type is used inside of an input `transform` function. The problem was that the reference emitter was trying to write a reference to the ambient type's source file which isn't necessary. Fixes angular#51424. PR Close angular#51474
…lar#51474) Fixes that the compiler was throwing an error if an ambient type is used inside of an input `transform` function. The problem was that the reference emitter was trying to write a reference to the ambient type's source file which isn't necessary. Fixes angular#51424. PR Close angular#51474
…lar#51474) Fixes that the compiler was throwing an error if an ambient type is used inside of an input `transform` function. The problem was that the reference emitter was trying to write a reference to the ambient type's source file which isn't necessary. Fixes angular#51424. PR Close angular#51474
Fixes that the compiler was throwing an error if an ambient type is used inside of an input
transformfunction. The problem was that the reference emitter was trying to write a reference to the ambient type's source file which isn't necessary.Fixes #51424.