Comments (5)
Not sure what you mean by "attach properties".
There are two issues in the code above: goog.string.Unicode
is not a valid variable identifier, and if this module is providing goog:goog.string.Unicode
it should do an export default var ...
.
The latter is a bit muddy on the Closure side as there is no syntax to express the case of exporting an object that has properties and is exports vs a module that exports multiple things separately (functions, vars, etc). We should be able to figure that out based on the goog.provide
s though.
from clutz.
I'm not sure either - we looked at this one together and you said a bunch of stuff was missing from the string.js because some properties are not present. Like where is startsWith ?
from clutz.
I see. My understanding is that the problem is that goog.string
does this:
goog.provide('goog.string');
goog.string.a = function() {};
goog.string.b = function() {};
...
Apparently c2dts doesn't handle that for some reason?
from clutz.
Problem is related to turning on closure pass. Instead of a null symbol.getType()
, it is wrapped as an object literal type.
from clutz.
A simple repro of the current bug is
goog.provide('a');
/**
* @param {number=} opt_precision
* @return {string}
*/
a.b = function(opt_precision) {
return goog.isDef(opt_precision) ? a.c(opt_precision) : "undef";
};
/**
* @param {number} s
* @return {string}
*/
a.c = function(s) {
return String(s);
};
If I run this through current closure-to-dts at head, I get
java.lang.AssertionError: JSC_TYPE_MISMATCH. actual parameter 1 of a.c does not match formal parameter
found : (number|undefined)
required: number at test.js line 8 : 43
from clutz.
Related Issues (20)
- Filter by Custom Tags Question HOT 4
- Do you use Clutz? How? HOT 2
- error: cannot find symbol import com.google.javascript.rhino.jstype.FunctionType.Parameter; HOT 6
- Question: externsMap on goog standard library
- test class_extends_array.js FAILED after 20190115 HOT 2
- Fix externs: DOMRect
- [gents] arrow functions with a single argument are not emitted properly syntactically HOT 1
- clutz should emit 'unknown' when translating '*'
- enum aliases are incorrectly emitted in partial mode HOT 4
- inner classes not emitted when outer class is emitted with named export
- declare legacy namespace + export obj + enum create wrong output HOT 1
- Static members on function not emitted
- gents does not handle goog.requireType HOT 2
- gents should convert @this
- Event vs KeyboardEvent
- Closure's `goog.isDefAndNotNull` seem to affect type inference and make clutz emit extra 'any's HOT 3
- JsDoc on static enums is not preserved
- clutz should not emit 'abstract' modifier on interfaces
- sonatype.org is erring with 'too many requests' on CI HOT 8
- Build are failing HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clutz.