-
-
Notifications
You must be signed in to change notification settings - Fork 251
Syntax lookup: Deprecated decorator #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ryyppy
merged 6 commits into
rescript-lang:master
from
kevanstannard:syntax-lookup-deprecated
May 15, 2021
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c86f3a0
Syntax lookup: Deprecated decorator
kevanstannard 54e7e92
Separate module and expression deprecated decorators
kevanstannard 9e475da
Tweak id
kevanstannard 8218cc6
Apply suggestions from code review
ryyppy 540a26a
Apply suggestions from code review
ryyppy 0227742
Change deprecation to deprecated in summary
kevanstannard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,47 @@ | ||
--- | ||
id: "expression-deprecated-decorator" | ||
keywords: ["deprecated", "decorator"] | ||
name: "@deprecated" | ||
summary: "This is the `expression deprecation` decorator." | ||
category: "decorators" | ||
--- | ||
|
||
The `@deprecated` decorator is used to annotate deprecated types, values and modules within a file. This may be used by ReScript tooling to highlight deprecated code during development. | ||
ryyppy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
See the `@@deprecated` decorator to deprecate whole file modules. | ||
ryyppy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Examples | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
@deprecated | ||
type person = {id: int, name: string} | ||
|
||
@deprecated | ||
let customDouble = n => n * 2 | ||
|
||
@deprecated("Use OtherModule.customTriple instead") | ||
let customTriple = n => n * 3 | ||
|
||
@deprecated("Use OtherModule instead") | ||
module MyModule = { | ||
type t | ||
} | ||
``` | ||
|
||
```js | ||
function customDouble(n) { | ||
return n << 1; | ||
} | ||
|
||
function customTriple(n) { | ||
return Math.imul(n, 3); | ||
} | ||
|
||
var MyModule = {}; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
|
This file contains hidden or 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,30 @@ | ||
--- | ||
id: "module-deprecated-decorator" | ||
keywords: ["deprecated", "decorator"] | ||
name: "@@deprecated" | ||
summary: "This is the `module deprecation` decorator." | ||
ryyppy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
category: "decorators" | ||
--- | ||
|
||
The `@@deprecated` decorator is used to indicate that a whole module is deprecated. This may be used by ReScript tooling to highlight deprecated code during development. | ||
ryyppy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
See the `@deprecated` decorator to deprecate expressions. | ||
ryyppy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Examples | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
// Indicate whole module is deprecated | ||
@@deprecated | ||
|
||
// Indicate whole module is deprecated, with a comment | ||
@@deprecated("Use OtherModule instead") | ||
``` | ||
|
||
```js | ||
``` | ||
|
||
</CodeTab> | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.