Am încercat să referință codul existent care utilizează lui Resig „extinde“, dar eu sunt obtinerea o grămadă de erori
------ test.ts --------
/// <reference path=myclass.js />
var m = new MyClass (3);
------ myclass.js --------
/// <reference path=class.js />
var MyClass = Class.extend({
init: function (i)
{
this.i = i;
},
})
------ class.js --------
(copied from http://ejohn.org/blog/simple-javascript-inheritance/)
erori:
Supplied parameters do not match any signature of call target
The name 'Class' does not exist in the current scope
The property 'extend' does not exist on value of type '() => void'
The name 'Class' does not exist in the current scope
Îmi dau seama că în cele din urmă aș vrea să rescrie codul-based extinde la typescript, dar până atunci, cum pot face referire la ea din nou cod?
Cred că acest lucru pune întrebarea mai profundă - de ce se plânge de erori de tip în JavaScript codul existent?













