They support typescript for static type checking but I am trying to use it with Flow. I have also converted the d.ts file available in their library to libdef files using the Probably Flow Typed project (https://github.com/Kegsay/ProbablyFlowTyped) - But i do not think that the file produced by this project is totally as per Flow libdef norms.
Even otherwise, ignoring all the yFiles errors arising when running Flow on a yFiles application (identifier 'yFiles'. Could not resolve name), i still get errors with 'define', 'require' modules like:
(function(r){(function(f){if("function"==typeof define&&define.amd){define( ['yfiles/lang','yfiles/core-lib'],f);}else{f(r.yfiles.lang,r.yfiles);}}(function (lang,yfiles){ ^^^^^^ identifierdefine`. Could not resolve name
SampleApplication.js:33
33: (function(r){(function(f){if("function"==typeof define&&define.amd){define( ['yfiles/lang','yfiles/core-lib'],f);}else{f(r.yfiles.lang,r.yfiles);}}(function (lang,yfiles){
^^^^^^ property yfiles. Propert y cannot be accessed on
33: (function(r){(function(f){if("function"==typeof define&&define.amd){define( ['yfiles/lang','yfiles/core-lib'],f);}else{f(r.yfiles.lang,r.yfiles);}}(function (lang,yfiles){
^ global object
require(["resources/data.js", "resources/data_1.js"], (function( ) {
^ The parameter passed to require() must be a literal string.
`
Another issue is:
I define some simple functions inside my yFiles application like:
total: function(numbers: Array): Number {
var result = 0;
for (var i = 0; i < numbers.length; i++) {
result += numbers[i];
}
return result;
},
and do: this.total(["Hi", 3, 4]);
Such types of type errors are not detected by Flow at the function call (ie, at this.total(["Hi",3,4]) ). All I get in such cases are:
SampleApplication.js:91
91: result += numbers[i];
^^^^^^ number. This type cannot be added to
91: result += numbers[i];
^^^^^^^^^^^^^^^^^^^^ string
SampleApplication.js:91
91: result += numbers[i];
^^^^^^^^^^^^^^^^^^^^ +=
88: total: function(numbers: Array): Number {
^^^^^^ Number. This type cannot be added to
91: result += numbers[i];
^^^^^^^^^^^^^^^^^^^^ string
SampleApplication.js:93
93: return result;
^^^^^^ number. This type is incompatible with t he expected return type of
88: total: function(numbers: Array): Number {
^^^^^^ Number
SampleApplication.js:93
93: return result;
^^^^^^ string. This type is incompatible with t he expected return type of
88: total: function(numbers: Array): Number {
^^^^^^ Number
Also, nullable types are not detected.
Is there a non trivial and small example of linking a third party JS app with Flow seamlessly?
Hi. I am trying to integrate Flow with yFiles for HTML - http://docs.yworks.com/yfileshtmlv2/index.html#/dguide/introduction
They support typescript for static type checking but I am trying to use it with Flow. I have also converted the d.ts file available in their library to libdef files using the Probably Flow Typed project (https://github.com/Kegsay/ProbablyFlowTyped) - But i do not think that the file produced by this project is totally as per Flow libdef norms.
Even otherwise, ignoring all the yFiles errors arising when running Flow on a yFiles application (identifier 'yFiles'. Could not resolve name), i still get errors with 'define', 'require' modules like:
(function(r){(function(f){if("function"==typeof define&&define.amd){define( ['yfiles/lang','yfiles/core-lib'],f);}else{f(r.yfiles.lang,r.yfiles);}}(function (lang,yfiles){ ^^^^^^ identifier
define`. Could not resolve nameSampleApplication.js:33 33: (function(r){(function(f){if("function"==typeof define&&define.amd){define( ['yfiles/lang','yfiles/core-lib'],f);}else{f(r.yfiles.lang,r.yfiles);}}(function (lang,yfiles){ ^^^^^^ property
yfiles
. Propert y cannot be accessed on 33: (function(r){(function(f){if("function"==typeof define&&define.amd){define( ['yfiles/lang','yfiles/core-lib'],f);}else{f(r.yfiles.lang,r.yfiles);}}(function (lang,yfiles){ ^ global objectrequire(["resources/data.js", "resources/data_1.js"], (function( ) { ^ The parameter passed to require() must be a literal string. ` Another issue is: I define some simple functions inside my yFiles application like: total: function(numbers: Array): Number {
var result = 0;
for (var i = 0; i < numbers.length; i++) {
result += numbers[i];
}
return result;
},
and do: this.total(["Hi", 3, 4]); Such types of type errors are not detected by Flow at the function call (ie, at this.total(["Hi",3,4]) ). All I get in such cases are:
SampleApplication.js:91 91: result += numbers[i]; ^^^^^^ number. This type cannot be added to 91: result += numbers[i]; ^^^^^^^^^^^^^^^^^^^^ string
SampleApplication.js:91 91: result += numbers[i]; ^^^^^^^^^^^^^^^^^^^^ += 88: total: function(numbers: Array): Number {
^^^^^^ Number. This type cannot be added to
91: result += numbers[i];
^^^^^^^^^^^^^^^^^^^^ string
SampleApplication.js:93 93: return result; ^^^^^^ number. This type is incompatible with t he expected return type of 88: total: function(numbers: Array): Number {
^^^^^^ Number
SampleApplication.js:93 93: return result; ^^^^^^ string. This type is incompatible with t he expected return type of 88: total: function(numbers: Array): Number {
^^^^^^ Number
Also, nullable types are not detected.
Is there a non trivial and small example of linking a third party JS app with Flow seamlessly?
Thanks.