microsoft / microsoft/typespec

Allow augment decorator of uninstantiated templates with arguments

Open
#1,774 0 comments 0 reactions 0 assignees View on GitHub
design:needed
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

PR #1744 fixed an issue where one could target template instantiations with illogical results. The fix implemented in the PR implemented the following logic:

**Error** `@@decorator(Foo, "blah")`
**Error** `@@decorator(Foo, "blah")`
**Okay** `@@decorator(Foo, "blah") // the template args left off`

The problem with this is the following scenario:
```
@doc("Page of {T}", T)
model Page {
items: T[];
}
```

The equivalent augment of this would be
`@@doc(Page, "Page of {T}", T)`

Unfortunately, due to #1744 this will yield an error.

The fix will likely require redesign of internals because it was discovered while implementing #1744 that somehow the TypeSpec cannot understand that `T` is different in this context than `string`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.