Closed lommez closed 7 years ago
@lommez Will look into ASAP.
There looks to have been some missing files from check-in to GitHub but I'm not sure if that is affecting you. Could you try again with updated 4.0.1 and see if you still have the same issue? I'm available today to fix this.
Hi @electricessence , Thanks for quick reply. I'm going to try with the new version. Is already available in github?
@lommez One moment. Publishing and verifying.
Thanks @electricessence
@lommez Ok everything looks good. Try now. How have you been getting the files?
Are you getting the entire GitHub repo or are you using NPM?
I'm getting the entire GitHub
@lommez Is there a reason why? How are you using in your project? The most common way to integrate is by using NPM and picking a specific dist...
No specific reason for that. Even using Visual Studio the best way is to use the NPM package?
@lommez So it's based upon your use case really. But typically speaking, let's say you are developing a NodeJS project.
Then I'm guessing it would be more straight forward to simply
npm install typescript-dotnet-commonjs --save
instead of pulling manually from GitHub.
This is also true for web projects, you could easily
npm install typescript-dotnet-umd --save
Or you could use Bower which I believe is integrated with VS.
The other way is to simply cherry pick the dist
you need and include it in your project. But as you can imagine that will be problematic to update later.
I'll need to update the release for Bower (doing now).
In my case, i'm developing web project and my application is using requirejs. I'll try to install it by using the command: npm install typescript-dotnet-commonjs --save
Don't do that
If you are using requirejs then use the AMD dist specifically.
npm install typescript-dotnet-amd --save
https://www.npmjs.com/package/typescript-dotnet-amd
That way you are leveraging an already minified and web ready version.
Thank you for the advice
No problem!
If you are familiar with RequireJS then this should work very nicely with your project. All classes are separate modules and load on demand. If you intend on using LINQ then note that
linqAsync(callback?: (linq: ILinqEnumerable<T>) => void): ILinqEnumerable<T>;
exists as part of CollectionBase.
So you can call it at anytime to dynamically load the LINQ extensions.
Once that has resolved the first time, you can then call .linq
from then on.
Please let me know if this fixes your issue.
The npm packages are done?
Yes they are up. Is that your question?
Now is building perfectly! But i'm having some trouble to download the javascript files using requirejs. Here is my tsconfig.json
{ "compilerOptions": { "module": "amd", "noImplicitAny": false, "noEmitOnError": true, "removeComments": false, "sourceMap": true, "target": "es5", "outDir": "typescript/generated" }, "exclude": [ "node_modules", "wwwroot" ] }
So when my application is trying to download for example, the file TimeSpan.js from:
http://myApplication/typescript/libs/typescript-dotnet-amd/System/Time/TimeSpan.js
that file can't be found because the physical files ares stored in
Do you know if there is any way to tell requirejs to download those files from that directory?
@lommez YES!
So there's some tricks in RequireJS. You can set 'aliases' for any directory.
So what I typically do... Is in my imports I will put
import {TimeSpan} from 'typescript-dotnet-amd/System/Time/TimeSpan';
And by using the require config I can define an alias for:
requirejs.config({
paths: {
"typescript-dotnet-amd": "[ the path ]"
},
});
You can even omit the -amd
from that point on...
The only caveat is that of course most people using TypeScript will want the types to come through automatically. And as long as that works, then great.
@lommez if you want to see this in action: https://github.com/electricessence/TypeScript.NET/tree/master/tests/qunit I added these qunit tests when I started to ensure that AMD continued to work and in the case of WebStorm everything works perfectly. It resolves the types and everything.
Thanks so much! I'll check those tests
@lommez You're welcome :)
@electricessence , now is working perfectly. It was missing in my tsconfig the path for the typescript-dotnet-amd. Congratulations on your excellent work.
I can't build my project. I'm attaching here an image showing the errors. https://portalvhdsdtx1sqp9m14cf.blob.core.windows.net/vhds/TypeScriptNet_Errors.jpg
It looks like it's missing some files.