microsoft / microsoft/typespec

Add `error` deprecation level

Open
#2,108 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

Follow up to #2107 from proposal https://gist.github.com/timotheeguerin/f525f392a5d39e3d3d92260167e62c3e

**This is not needed at the time is created to track intrest.**

A 2nd optional parameter to the deprecation directive could be added later which lets you upgrade the severity to an `error`

Advantage of this is you can use that to show that something was removed by give it a better error than it just being gone to users.

You could also imaging a deprecation cycle that increase the severity.

1. warning: will be removed soon
2. error: has been removed

```tsp
#deprecate "This has been removed in version 2.0, use X instead." "error"
```

What should be emitted if referencing a type with the following deprecated annotations

| Case | Default | `--check-deprecation` |
| ------------------------------------ | ------------ | --------------------- |
| `#deprecated "Default"` | diag warning | diag warning |
| `#deprecated "As warning" "warning"` | diag warning | diag warning |
| `#deprecated "As error" "error"` | diag error | diag error |

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.