-
Notifications
You must be signed in to change notification settings - Fork 18
Typescript deprecated jsdoc #149
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
bulldozer-bot
merged 5 commits into
palantir:develop
from
rhysbrettbowen:typescript-deprecated-jsdoc
Oct 14, 2020
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
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
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
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
20 changes: 20 additions & 0 deletions
20
...ds/generate/__tests__/resources/test-cases/example-types/product/deprecatedEnumExample.ts
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,20 @@ | ||
| export enum DeprecatedEnumExample { | ||
| ONE = "ONE", | ||
| /** | ||
| * @deprecated use ONE | ||
| */ | ||
| OLD_ONE = "OLD_ONE", | ||
| /** | ||
| * You should no longer use this | ||
| * | ||
| * @deprecated use ONE | ||
| */ | ||
| OLD_DEPRECATED_ONE = "OLD_DEPRECATED_ONE", | ||
| /** | ||
| * You should no longer use this | ||
| * | ||
| * @deprecated should use ONE | ||
| * | ||
| */ | ||
| OLD_DOCUMENTED_ONE = "OLD_DOCUMENTED_ONE" | ||
| } |
20 changes: 20 additions & 0 deletions
20
...s/generate/__tests__/resources/test-cases/example-types/product/deprecatedFieldExample.ts
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,20 @@ | ||
| export interface IDeprecatedFieldExample { | ||
| 'one': string; | ||
| /** | ||
| * @deprecated use ONE | ||
| */ | ||
| 'deprecatedOne': string; | ||
| /** | ||
| * You should no longer use this | ||
| * | ||
| * @deprecated use ONE | ||
| */ | ||
| 'documentedDeprecatedOne': string; | ||
| /** | ||
| * You should no longer use this | ||
| * | ||
| * @deprecated should use ONE | ||
| * | ||
| */ | ||
| 'deprecatedWithinDocumentOne': string; | ||
| } |
92 changes: 92 additions & 0 deletions
92
...commands/generate/__tests__/resources/test-cases/example-types/product/deprecatedUnion.ts
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,92 @@ | ||
| export interface IDeprecatedUnion_Good { | ||
| 'good': string; | ||
| 'type': "good"; | ||
| } | ||
|
|
||
| /** | ||
| * @deprecated use good | ||
| */ | ||
| export interface IDeprecatedUnion_NoGood { | ||
| 'noGood': string; | ||
| 'type': "noGood"; | ||
| } | ||
|
|
||
| /** | ||
| * this is no good | ||
| * @deprecated use good | ||
| */ | ||
| export interface IDeprecatedUnion_NoGoodDoc { | ||
| 'noGoodDoc': string; | ||
| 'type': "noGoodDoc"; | ||
| } | ||
|
|
||
| function isGood(obj: IDeprecatedUnion): obj is IDeprecatedUnion_Good { | ||
| return (obj.type === "good"); | ||
| } | ||
|
|
||
| function good(obj: string): IDeprecatedUnion_Good { | ||
| return { | ||
| good: obj, | ||
| type: "good", | ||
| }; | ||
| } | ||
|
|
||
| function isNoGood(obj: IDeprecatedUnion): obj is IDeprecatedUnion_NoGood { | ||
| return (obj.type === "noGood"); | ||
| } | ||
|
|
||
| /** | ||
| * @deprecated use good | ||
| */ | ||
| function noGood(obj: string): IDeprecatedUnion_NoGood { | ||
| return { | ||
| noGood: obj, | ||
| type: "noGood", | ||
| }; | ||
| } | ||
|
|
||
| function isNoGoodDoc(obj: IDeprecatedUnion): obj is IDeprecatedUnion_NoGoodDoc { | ||
| return (obj.type === "noGoodDoc"); | ||
| } | ||
|
|
||
| /** | ||
| * @deprecated use good | ||
| */ | ||
| function noGoodDoc(obj: string): IDeprecatedUnion_NoGoodDoc { | ||
| return { | ||
| noGoodDoc: obj, | ||
| type: "noGoodDoc", | ||
| }; | ||
| } | ||
|
|
||
| export type IDeprecatedUnion = IDeprecatedUnion_Good | IDeprecatedUnion_NoGood | IDeprecatedUnion_NoGoodDoc; | ||
|
|
||
| export interface IDeprecatedUnionVisitor<T> { | ||
| 'good': (obj: string) => T; | ||
| 'noGood': (obj: string) => T; | ||
| 'noGoodDoc': (obj: string) => T; | ||
| 'unknown': (obj: IDeprecatedUnion) => T; | ||
| } | ||
|
|
||
| function visit<T>(obj: IDeprecatedUnion, visitor: IDeprecatedUnionVisitor<T>): T { | ||
| if (isGood(obj)) { | ||
| return visitor.good(obj.good); | ||
| } | ||
| if (isNoGood(obj)) { | ||
| return visitor.noGood(obj.noGood); | ||
| } | ||
| if (isNoGoodDoc(obj)) { | ||
| return visitor.noGoodDoc(obj.noGoodDoc); | ||
| } | ||
| return visitor.unknown(obj); | ||
| } | ||
|
|
||
| export const IDeprecatedUnion = { | ||
| isGood: isGood, | ||
| good: good, | ||
| isNoGood: isNoGood, | ||
| noGood: noGood, | ||
| isNoGoodDoc: isNoGoodDoc, | ||
| noGoodDoc: noGoodDoc, | ||
| visit: visit | ||
| }; |
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
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
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
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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| # User versions.props so that excavator can automatically keep our version up to date | ||
| com.palantir.conjure.verification:* = 0.18.5 | ||
| com.palantir.conjure:conjure = 4.6.1 | ||
| com.palantir.conjure:conjure = 4.13.0 |
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 |
|---|---|---|
|
|
@@ -1516,10 +1516,10 @@ concat-stream@^1.5.0: | |
| readable-stream "^2.2.2" | ||
| typedarray "^0.0.6" | ||
|
|
||
| conjure-api@^4.3.0: | ||
| version "4.3.0" | ||
| resolved "https://registry.yarnpkg.com/conjure-api/-/conjure-api-4.3.0.tgz#c778736f369e7c749a86118e14dab83deb698ace" | ||
| integrity sha512-AnZe6qkiCRSsfuQMgA556dFs+/DbXpCK2uuhq9bHn36dSbKi+6HUDntpc9jkVPzWOecLXGqy+JAD6IKV8c9Sqw== | ||
| conjure-api@^4.13.0: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why did we need to bump the conjure API?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old one did not contain the "deprecated" key |
||
| version "4.13.0" | ||
| resolved "https://registry.yarnpkg.com/conjure-api/-/conjure-api-4.13.0.tgz#3afb10e2ba3fefb582ce7cb20b259d096aab6895" | ||
| integrity sha512-ATtXX42n9WwEOrMdQpMYJreauyiBDf+5XmXATjE5Ky2nozlgu2DNXXajrXKzPhBM1XEjeTH4JS5zwlE4/JhnmA== | ||
|
|
||
| conjure-client@^2.4.1: | ||
| version "2.4.1" | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid mutating objects and instead construct a better doc string when creating the object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed so it doesn't mutate. It is a little weird how before though the docs were being put on as a JSDocStructure when a string will do. I also saw it took an array so tried to pass it in with 2 strings, but the second would not be picked up. I'm guessing it's just old code so just changed to pass back a string[] or undefined.