You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tern...@googlegroups.com
Hi,
I was wondering if there's an option to force the type if the type is specified by JSDoc. For example, if I have the code below, I'd expect only codecompletion on the number type
/**
* @returns{Number}
*/
function test(){
returns 'hello'
}
According to me, when JSDoc specifies something, that should be leading and additional types retrieved through inference should be ignored.
Ideally, a validator (tern.lint for example) would raise an error here that the function returns a value that is not of the type declared in the JSDoc
If this is not yet available, could this be (easily) added?
TIa,
Paul
Marijn Haverbeke
unread,
Dec 4, 2014, 6:04:37 AM12/4/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Paul, tern-dev
I don't think this should be the default behavior, but patch
https://github.com/marijnh/tern/commit/8f485d5577b8aca60ccef01225f41fa5b252100a implements this as an optional setting. If you configure the
doc_comment plugin with strong: true in your .tern-project file, it'll
assign a higher-than-default weight to the types it finds in comments,
and thus overrides inferred types.
Does this work for you?
> --
> You received this message because you are subscribed to the Google Groups
> "tern-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tern-dev+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.