Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SomeClass{
- constructor(){}
- mainMethod(HTMLElement|PaperElement element, StreamBuffer stream) /* I select this */
- }
- class SomeClass{
- constructor(){}
- mainMethod(element, stream){
- if(element instanceof HTMLElement || element instanceof PaperElement){
- if(stream instanceof StreamBuffer){
- /* My cursor appear here */
- }
- else{
- throw new TypeError('2nd argument should be StreamBuffer');
- }
- }
- else{
- throw new TypeError('1st argument should be HTMLElement or PaperElement');
- }
- }
- }
- class SomeClass{
- ...
- otherMethod(String str, notypearg, [optionalarg]) /* I select this */
- }
- class SomeClass{
- ...
- otherMethod(str, notypearg, optionalarg){
- if(typeof(str) == 'string'){
- if(notypearg){
- /* My cursor appear here */
- // nothing for optionalarg
- }
- // No error for args without type
- }
- else{
- throw new TypeError('1st argument should be String');
- }
- }
- }
Add Comment
Please, Sign In to add comment