yuntaozhu / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

--jscomp_error=checkTypes for goog.style #571

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
1. compile with --jscomp_error=checkTypes
2. use goog.style

What is the expected output? What do you see instead?

successful compilation

What version of the product are you using? On what operating system?

type error, because goog.events.Event is not found. And then, as the (el) 
variable is polymorphic, the compiler doesn't find the method 
getBrowserEvent(). A typecast is performed to allow a --jscomp_error=checkTypes 
compilations

https://spreadsheets.google.com/formResponse?key=p9iNysFj43uDtUPeRrKvGNQ

Original issue reported on code.google.com by lgand...@gmail.com on 8 Jul 2013 at 8:33

Attachments:

GoogleCodeExporter commented 8 years ago
see:
https://code.google.com/p/closure-library/wiki/FrequentlyAskedQuestions#When_I_c
ompile_with_type-checking_on,_I_get_warnings_about_"

Original comment by Nicholas.J.Santos on 10 Jul 2013 at 1:02

GoogleCodeExporter commented 8 years ago
Is there a way to --jscomp_error=checkTypes without being stopped by the 
compiler? I find it the most useful feature of closure-library to add static 
typing to javascript. 

Maybe i'm choosing the wrong tool, but what do you do then to have statically 
safe programs?

Original comment by lgand...@gmail.com on 10 Jul 2013 at 1:07

GoogleCodeExporter commented 8 years ago
yes, read the FAQ. you need to make sure the deps file is included in the 
compilation, to forward-declare types.

Original comment by Nicholas.J.Santos on 11 Jul 2013 at 12:23