Comments (5)
+1 on not emitting call
/apply
for ctors, AFAIK it's even illegal to use
apply
on an ES6 class, so this is bound to only cause confusion.
Rado Kirov [email protected] schrieb am Mi., 2. Sep. 2015 um
02:47 Uhr:
For example if B extends A and takes string instead of number, we generate:
declare namespace f {
class A {
constructor(n: number);
static call(a: A, n: number);
}class B extends A { constructor(s: string); static call(b: B, n: string); }
}
TS barfs on the static call for B which is required to subtype A's
functional type. See 'oog.fx.dom.PredefinedEffect' and 'Animation' for
closure lib repro.Maybe we should not output call and apply for constructor functions until
someone really needs them. I can't come up with a good need for using those
in sane TS code.—
Reply to this email directly or view it on GitHub
#76.
from clutz.
Turns out these static methods are only output if they are used somewhere else (most likely for implementing super constructor calls).
from clutz.
I can't get the following Closure code to compile in our test harness:
/**
* @constructor
* @param {number} n
*/
multi_class.A = function(n) {
/** @type {number} */
this.a = n;
};
/**
* @constructor
* @extends {multi_class.A}
*/
multi_class.B = function() {
/** @type {number} */
this.b = 1;
multi_class.A.call(this, 0);
};
goog.inherits(multi_class.B, multi_class.A);
with error java.lang.AssertionError: JSC_UNDEFINED_NAME. multi_class.A.call is never defined at test.js line 21 : 2
Closure complains that it can't find call
on multi_class.A
, even though that's the pattern that goog.fx.dom.PredefinedEffect
and subclasses use.
Works fine in the standalone cl compiler which probably means we are have some different flag setting.
from clutz.
cc @MatrixFrog
from clutz.
I think it would still be good to know why the type system works this way, but I suspect the new type system is a little more sane so I'm not overly worried about it.
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.