Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion bindings/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ func (b *Bindings) CommentGojaObject(comments []SyntheticComment, object *goja.O
sep := ""
for _, cmt := range jsDoc {
jsDocComment.WriteString(sep)
jsDocComment.WriteString(cmt.Text)
jsDocComment.WriteString(convertDeprecation(cmt.Text))
sep = "\n *"
}
jsDocComment.WriteString("\n ")
Expand Down Expand Up @@ -790,3 +790,11 @@ func (b *Bindings) CommentGojaObject(comments []SyntheticComment, object *goja.O

return node, nil
}

func convertDeprecation(txt string) string {
if len(txt) > 13 && txt[:13] == " Deprecated: " {
return " @deprecated " + txt[13:]
}

return txt
}
6 changes: 6 additions & 0 deletions testdata/comments/comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ type BlockComment struct {

// Constant is just a value
const Constant = "value" // An inline note

// DeprecatedComment is a comment with a deprecation note
//
// Deprecated: this type is no longer used
type DeprecatedComment struct {
}
9 changes: 9 additions & 0 deletions testdata/comments/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ export interface CommentedStructure {
export const Constant = "value"; // An inline note


// From comments/comments.go
/**
* DeprecatedComment is a comment with a deprecation note
*
* @deprecated this type is no longer used
*/
export interface DeprecatedComment {
}

// From comments/comments.go
export interface InheritedCommentedStructure extends CommentedStructure {
}