Git Product home page Git Product logo

typescript.net's Introduction

MOVED

https://github.com/electricessence/TypeScript.NET-Core

For numerous reasons, TypeScript.NET has been archived in favor of breaking it up into more managable pieces that can be improved upon independently. See the above link for details.

TypeScript.NET (Archive)

A JavaScript-Friendly .NET Based TypeScript Library

Patreon donate button Or support by taking this course: https://www.udemy.com/stepping-up-to-typescript-fundamentals/

The intention of this project to to allow for the evolution of a .NET based TypeScript (and resultant JavaScript) library. Contributions are welcomed as the .NET Library (meaning it's class structure and classes, not necessarily its content) has a substantial amount of usefulness. With the open sourcing of .NET, TypeScript seems the most logical means to take advantage of it. Typing, generics, classes, modules, inheritance, all are required to make a resultant JavaScript library that takes advantage of this elegance.

Much inspiration comes from TypeScript itself and from libraries like linq.js. There is of course some variance away from .NET's convention (camelCase methods in favor of TitleCase) and some things simply have to be done different. "Extensions" as a feature might be one of the greatest additions to .NET that JavaScript doesn't have a plan for, but it does have some tricky equivalents.

If you have a .NET Library class that you want to see represented in TypeScript, submit it (as an issue), or contribute it yourself! :)

Why should I use this, let alone TypeScript?

  1. It's 100% compatible with JavaScript. Currently TypeScript .NET's target is ES5, so legacy ES3 won't work. Mainly because of accessors. But going forward, TypeScript is nearly the same as ES6 and you don't have to change your source code to target newer versions. :)
  2. TypeScript is lead by Anders Hejlsberg, the founder of C#. You will feel quite at home in TypeScript if you are a fan of typed languages (like C#), but at the same time you'll get all the flexibility and compatibility of JavaScript. See www.typescriptlang.org for more information about the TypeScript language. Also some more good info on Wikipedia.
  3. The benefits of intellisense and using an IDE for programming should be obvious especially if you are coding for a larger project. Typed compilation is less forgiving in a good way. You simply make much less mistakes in the long run. TypeScript might be the best answer to JavaScript yet. It's still JavaScript, but with many bonuses including a growing community. :)
  4. Most major IDEs and text editors now support TypeScript either built in, or via a plug-in:
  • Visual Studio
  • VS Code
  • WebStorm (Strongly recommended! Makes NodeJS development a dream.)
  • Sublime Text
  • Atom

To name a few.

Release Notes:

  • 4.0.0: Marks the first release using TypeScript 2. Strict Null Checking is built in and will propagate through generics as it should.

Highlights

  • Linq: Full linq.js library ported to TypeScript with improvements and optimizations. Proper use of IEnumerable<T> with passing unit tests. All the things you love about Linq, but fully typed and JS compatible. **All collections now support a .linq lazy helper property when using NodeJS/CommonJS.
  • Exceptions: There is a growing set of Exceptions like ArgumentNullException, ArgumentOutOfRangeException, etc that are useful in making decisions about how to handle errors using instanceof as if you used multiple catch statements in C#.
  • Collections: Multiple collections types with standard ICollection<T> and IEnumerable<T> interfaces. LinkedList<T>, Queue<T>, Dictionary<T>, and more, all unit tested using a common interface test of ICollection<T>. **
  • IDisposable: Additional interfaces, utilities, and classes like DisposableBase that help in providing a cleanup pattern for larger applications that may easily encounter memory leaks. Many of the classes within, including IEnumerator<T>, use IDisposable to ensure releasing of references.
  • ObjectPool: There are some cases where internal objects are used quite often and instead of relying on the garbage collector to do cleanup, a performance/efficiency gain can be attained by using an ObjectPool. See actual use here.
  • DateTime & TimeSpan: The System/Time namespace takes these .NET classes and goes even further to provide useful classes for calculating and expressing dates and time.
  • Uri, QueryParams, & QueryBuilder: Having a typed class and interface for an Uri tends to be very useful in web development. Originally inspired by the .NET System.Uri class, these have been written from scratch to be more useful and helpful for debugging in JavaScript and are based upon the URI specification.
  • Regex: Includes named group captures. Very handy for accessing groups in regular expression results.
  • Promise<T> and LazyPromise<T>: An efficient set of promises that fills that follows the standard ES6 usage while allowing for some useful methods that can improve performance of your application. Read more here.
  • Parallel: Simplifies distributing tasks to a 'Worker'. Has ability to map and reduce and results in a Promise<T>.
  • TypeValidator<T>: An easy to use runtime type checker for complex types or JSON. Read more here.
  • Currently no external dependencies.

Usage

After some time and effort, I've decided that this library should be module based since there are too many files and dependencies that may or may not get used. This is simply the right decision and results in:

  • Only loading what you need, when you need it. You can import the entire TypeScript .NET library in your project and not worry about extra bytes you don't want.
  • Compiling modules into a monolithic library is easier than the reverse.
  • If you care about bundling and minification, 'r.js optimizer' is probably the right way to go.
  • The modular structure is not limited to requirejs since it should work perfectly well with JSPM/SystemJS.
  • It is easy to change the module types. :)
  • You can easily recompile the entire library into another folder fully minified using gulp.
  • Already minified with source-map versions are provided in the dist folder
Why not take this a step further and break it up into separate NPM style modules/packages?

There is a point where fragmentation and over-granularity just make life harder. If one module depends on another and you want to implement improvements it's just easier if they live in the same place.

Version 2.5 was the first NPM release. The goal is to get this as user friendly as possible.

All distributions contain source-maps.
https://www.npmjs.com/search?q=typescript-dotnet

npm install typescript-dotnet-umd

It's highly recommended to use the UMD (minified) version for most cases since it works for AMD and CommonJS.
Note: WebPack has trouble with UMD. Use CommonJS or AMD if you intend to use WebPack.

All Published NPM Module Types

Install on only the module type you need in order to avoid type collisions.

Currently it is possible/supported to use TypeScript .NET in a number of different ways:

Import Examples:

import Enumerable from "typescript-dotnet-es6/System.Linq/Linq"
Recommended for users who are deploying directly to web/browsers:

Note: WebPack has trouble with UMD. Use CommonJS or AMD if you intend to use WebPack.

import Enumerable from "typescript-dotnet-umd/System.Linq/Linq"
Pure (unminified ES5) CommonJS is available this way:
import Enumerable from "typescript-dotnet-commonjs/System.Linq/Linq"
Recommended for users who want pure minified AMD (RequireJS) with source-maps:
import Enumerable from "typescript-dotnet-amd/System.Linq/Linq"
bower install typescript-dotnet

This should also include require.js in your bower components directory. If you need another module type other than AMD, the TypeScript files are included so you can rebuild however you need.

PM> Install-Package TypeScript.NET.Library

Unit Tests

Mocha tests are in place for core functionality and expanding all the time. Istanbul is used for code coverage. Current coverage is good if not reasonable.

Examples

Currently the unit test cover many example usages.

Documentation

Currently improving over time using JSDoc style comments and TypeDoc. View Documentation: electricessence.github.io/TypeScript.NET/documentation

Documentation has a tendency to lag behind and TypeDoc is also lagging on updates.

Contribution

This library has immense potential and quite often a class, or function that is missing will simply be added. If you log any issues here on GitHub they will likely be addressed swiftly. If you have a class or module you'd like to see integrated, just log an issue and start the discussion or feel free to make a pull request from your own design. :)

Discussion

Join the chat at https://gitter.im/electricessence/TypeScript.NET

Reddit

TypeScript.NET Library

.NET, TypeScript

Learn, Connect & Evolve

Stepping up to Typescript: Fundamentals

Code Evolution

www.youtube.com/channel/UCG2QyAgVUEKSMBaC0Fkp5GQ

Click an image below to watch.

Intro to TypeScript.NET Library (Part 1)

TypeScript.NET v3 Release Info/Update

typescript.net's People

Contributors

304notmodified avatar deap82 avatar electricessence avatar galvesribeiro avatar gitter-badger avatar johnweisz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

typescript.net's Issues

Initializers are not allowed in ambient contexts

Hi,
I´ve downloaded the latest version, [email protected].
And the compiler is raising that exception:
"Error TS1039 Initializers are not allowed in ambient contexts."
On file typescript-dotnet-amd\System\ExceptionType.d.ts.
I'm using typescript 2.1.4.
Do you know why this is happening?
Thanks!

System.Guid type support

Hi,
I just found your TypeScript library as i started researching typescript + .net mapping tools. Its really great. I wondering how difficult would be to add something like JS Guid support. You have a Datetime support already and adding support for GUID would allow to use your library with Sql mappers as primary key is GUID most the time. My typescript knowledge is just beginners level and it would be great if the pro like you would add directly to this library. What do you think?

Linq: skip() & takeExceptLast() together will result in exception

console.log(Enumerable.from([1,2,3,4,5,6]).skip(1).takeExceptLast(2).toArray());

==========out put============

C:\Users\Admin\AppData\Roaming\npm\node_modules\typescript-dotnet-commonjs\System\Collections\Enumeration\EnumeratorBas
e.js:130
throw e;
^
ArgumentOutOfRangeException: {stop} NaNis less than start
at updateRange (C:\Users\Admin\AppData\Roaming\npm\node_modules\typescript-dotnet-commonjs\System\Collections\Array
\Utility.js:110:15)
at Object.clear (C:\Users\Admin\AppData\Roaming\npm\node_modules\typescript-dotnet-commonjs\System\Collections\Arra
y\Utility.js:118:5)
at Queue._clearInternal (C:\Users\Admin\AppData\Roaming\npm\node_modules\typescript-dotnet-commonjs\System\Collecti
ons\Queue.js:80:16)
at Queue.CollectionBase._onDispose (C:\Users\Admin\AppData\Roaming\npm\node_modules\typescript-dotnet-commonjs\Syst
em\Collections\CollectionBase.js:142:14)
at Queue._onDispose (C:\Users\Admin\AppData\Roaming\npm\node_modules\typescript-dotnet-commonjs\System\Collections
Queue.js:90:37)
at Queue.DisposableBase.dispose (C:\Users\Admin\AppData\Roaming\npm\node_modules\typescript-dotnet-commonjs\System
Disposable\DisposableBase.js:30:19)

How about a TryCast method?

How about a TryCast method? Could be useful with ajax and unknown types... Also, just wanted to say this project is awesome and mind boggling that the community hasn't migrated here yet.

System.Xml.XmlConvert

It will be necessary to have something analogous to these static methods in order to ensure conversion is the same.

System.Threading.Task

Start the Threading namespace by adding the Task class.
This will ultimately be super useful for managing deferred timeouts.
After reviewing other defer utilities and how timeouts are managed/cancelled/disposed, etc, this really needs to happen.

orderBy is not working

Sample code for reproduction:

                var sorted = Linq.Enumerable.fromArray<ICustomer>(customers)
                    .orderBy(c => c.Name)
                    .toArray();

Let ICustomer be some Interface with a Name-property.
Then look at "sorted"'s values. Most of them are "undefined" :-(

module load error in VS2015 node console application

Hi,

I'm following the steps that you had shown in the video. However I'm using VS2015 instead of WebPack. I'm trying to use the library in a console nodejs project in VS2015. I've installed the library using npm. However it is giving me below error.

Error TS2307 Cannot find module 'typescript-dotnet-umd/dist/es6/System.Linq/Linq'.

Could you please help me out here in resolving the error?

Also can you please update the documentation with examples from JSON and other functions such as where, find, filter etc?

Constraint of a type parameter cannot reference any type parameter from the same type parameter list.

Constraint of a type parameter cannot reference any type parameter from the same type parameter list.

I'm getting this error in Visual Studio for ILinkedNodeList, ILinkedNode and assertValidDetached.

I fixed it by replacing "TNode" with "any":

interface ILinkedNodeList<TNode extends ILinkedNode<TNode>>
interface ILinkedNodeList<TNode extends ILinkedNode<any>>

Any other solutions or should I create a PR?

Visual Studio 2015, Update 1
TypeScript 1.7.6.0

Unnecessary bitwise or operators

System/Compart.ts, the CompareResult enum is using a bitwise operator for each value. These operators seem unnecessary because you have a literal number oring against a literal zero. I was just curious as to why the author decided to do this.

Fix gulp tasks to properly use tsconfig.json.

This is such a pain. I have to use different utilities to ensure the output matches what WebStorm does even when pointing to the lib. :(

Need to have this fixed as it is interfering with other steps like noEmitHelpers.

Minimal setup?

I'm starting a new project and would like to include TypeScript.NET.

What's the minimal setup needed to use it? The NuGet package installed source and dist folders. I would like to just have it sit under Scripts in a single folder.
What things do I have to delete and move to use the full library with a minimal number of files?

Watch an array modifications

Hi,

For example, i have an array like that:

var numbersArray = [1, 2, 3, 5, 6];
var myEnumerable = Enumerable.from(numberArray);
function total(): number {
return myEnumerable.sum();
}

numberArray.push(7);

In my application i'm using angular and binding the total result in the view.
Is possible whenever the numbersArray suffer any modification to be updated in the view?

Resharper Conflict

I'm using Resharper 2016.2.2 and for unknown reason after added the typescript.net in my project the Visual Studio crash.
Anyone else is having the same issue? Is that a known bug?
The only temporally solution for that is to disable the Resharper.

using (IDisposable) in functions not returning void

Hi,

tried to port some logging helper from c#/java to typescript. The class EnterExitLogger is disposable and logs function entry (constructor) and exit (dispose).

The following usage works as expected:
protected usingTester() { var logger; using(logger = new EnterExitLogger(log, Log.Level.DEBUG, 'usingTester'), () => { return 1234; }); }

But when I have a function returning a value, I get a typescript error:
protected usingTesterReturn(): number { var logger; using(logger = new EnterExitLogger(log, Log.Level.DEBUG, 'usingTesterReturn'), () => { return 1234; }); }

Error: A function whose declared type is neither 'void' nor 'any' must return a value.

Do you have any idea how to handle this issue?

Regards,
Walter

Confusing repository description

"A JavaScript Friendly .NET Based Library Ported to TypeScript"

Implies that its a port of an already existing "Javascript-Friendly .NET Based library" to TypeScript.

a) If the library IS a port to TypeScript of an existing "JavaScript Friendly .NET Based library" the name of this library should be mentioned in the description and be read as "A TypeScript port of ${LibraryName}"

b) If the library IS NOT a port of an existing "JavaScript Friendly .NET Based library", but a port of .NET to TypeScript the description should be something like "A TypeScript port of .NET".

Bug affecting project output

Steps to reproduce.

Create a folder structure like this(the + signal is just to illustrate the folder level:

+ testbug
++ build
++ src
+++ Person.ts
++ tsconfig.json

Have the following config on tsconfig.json:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true,
        "sourceRoot": "./src",
        "moduleResolution": "node",
        "outDir": "./build"
    },
    "exclude": [
        "node_modules",
        "build"
    ]
}

And the following src/Person.ts:

console.log('something');

Save everything and build the project (VSCode or tsc command line). Note that output files are dropped correctly to build/ folder.

Now, npm install typescript-dotnet --save and npm update --save.

Change the content of src/Person.ts to:

import List from "typescript-dotnet/dist/commonjs/System/Collections/List"

export class Person
{
    Name:string;
    Age:number;
}

Delete the content of the build/ folder.
Save all and now build the project again.

Notice that the output files are dropped into build/src/ instead of the src/ root folder.

The expected behavior is that the files got dropped on build/ while they are sent to the build/src. To confirm that the problem is with this module, comment the firs line (import List from....), clear the build directory and build again. You will see that the files are now again dropped correctly.

What can we do to workaround it?

Thanks for the great work on the project.

Best regards,
Gutemberg

Declaration files

Hi, Does this library come with declaration files? If not, then how are we supposed to use it?

Provide a NuGet package

Found this today and it seems to have the potential to replace my homegrown pseudo-collections :)
Thanks a lot for your work!

Two remarks:

  • I think the Collections + LINQ part is the most important one, please make sure it is rock solid and complete before moving over to other .NET classes
  • Please consider offering this as NuGet package, I've gotten addicted to it and can't add libs on my own anymore ;)

Names not compatible with C#

I notice that the method names are using the Javascript convention of a lower-case first character, whereas the .NET convention is upper case. If the purpose here is to generate a compatible library for porting C# to Typescript, why put the user through the tedious process of changing the first letter of every method call? If the purpose is to provide a familiar interface for people who already know C# and the .NET libraries, why diverge from the familiar interface?

For example, look at the Dictionary implementation.

nuget package

Hi
I'm trying to include the nuget package version 3.1.7 into visual studio.
Unfortunately I get following exceptions:

1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\Array\Utility.ts(101,35): error TS2450: Build:Left-hand side of assignment expression cannot be a constant or a read-only property.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\Array\Utility.ts(105,3): error TS2450: Build:Left-hand side of assignment expression cannot be a constant or a read-only property.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\Array\Utility.ts(182,4): error TS2450: Build:Left-hand side of assignment expression cannot be a constant or a read-only property.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\Array\Utility.ts(213,3): error TS2450: Build:Left-hand side of assignment expression cannot be a constant or a read-only property.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\Array\Utility.ts(246,9): error TS2450: Build:Left-hand side of assignment expression cannot be a constant or a read-only property.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\Array\Utility.ts(321,4): error TS2450: Build:Left-hand side of assignment expression cannot be a constant or a read-only property.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\CollectionBase.ts(290,31): error TS2450: Build:Left-hand side of assignment expression cannot be a constant or a read-only property.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\CollectionBase.ts(295,4): error TS2450: Build:Left-hand side of assignment expression cannot be a constant or a read-only property.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\Dictionaries\Dictionary.ts(31,7): error TS2420: Build:Class 'HashEntry<TKey, TValue>' incorrectly implements interface 'IHashEntry<TKey, TValue>'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\Dictionaries\Dictionary.ts(70,14): error TS2339: Build:Property 'getHashCode' does not exist on type '{}'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\Dictionaries\Dictionary.ts(190,20): error TS2345: Build:Argument of type 'HashEntry<TKey, TValue>' is not assignable to parameter of type 'IHashEntry<TKey, TValue>'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\Dictionaries\Dictionary.ts(191,19): error TS2345: Build:Argument of type 'HashEntry<TKey, HashEntry<TKey, TValue>>' is not assignable to parameter of type 'IHashEntry<TKey, IHashEntry<TKey, TValue>>'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\LinkedNodeList.ts(440,6): error TS2450: Build:Left-hand side of assignment expression cannot be a constant or a read-only property.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Promises\Promise.ts(427,5): error TS2322: Build:Type '{}' is not assignable to type 'T'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Uri\Uri.ts(120,4): error TS2345: Build:Argument of type '"" | "file" | "gopher" | "ftp" | "http" | "https" | "ldap" | "mailto" | "net.pipe" | "net.tcp" | ...' is not assignable to parameter of type 'SchemeValue'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Collections\LinkedList.ts(36,7): error TS2420: Build:Class 'InternalNode' incorrectly implements interface 'INodeWithValue'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Events\EventDispatcherBase.ts(114,4): error TS2322: Build:Type '{}' is not assignable to type 'IEventBase'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Events\EventDispatcherBase.ts(140,14): error TS2339: Build:Property 'target' does not exist on type '{ new (type: string, eventInitDict?: EventInit): Event; prototype: Event; readonly AT_TARGET: num...'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Events\EventDispatcherBase.ts(141,20): error TS2345: Build:Argument of type '{ new (type: string, eventInitDict?: EventInit): Event; prototype: Event; readonly AT_TARGET: num...' is not assignable to parameter of type 'Event'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Threading\Tasks\eval.ts(5,1): error TS6053: Build:File 'c:/users/mh/documents/visual studio 2015/Projects/TypeScriptHTMLApp4/TypeScriptHTMLApp4/typings/node/node.ts' not found.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Threading\Tasks\eval.ts(7,12): error TS2304: Build:Cannot find name 'module'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Threading\Tasks\eval.ts(7,38): error TS2304: Build:Cannot find name 'module'.
1>c:\users\mh\documents\visual studio 2015\Projects\TypeScriptHTMLApp4\TypeScriptHTMLApp4\source\System\Threading\Tasks\eval.ts(8,2): error TS2304: Build:Cannot find name 'process'.

The Build:Left-hand side of assignment expression cannot be a constant or a read-only property. error is solvable with (object as any).test = 1234;

But the others error I have no clue.

Maybe I'm doing sth wrong?

Any help appreciated.

Doesn't build.

I installed the Nuget package TypeScript.NET.Library into my project. When I try to build, it is looking for a node.ts file. There are 4 *.d.ts in the node package.

  1. What version of the node.ts file am I supposed to load?
  2. Please make this a dependency of the Nuget Package.

Thanks

Group bug? (version 2.1.0 from nuget)

Hello, first of all i want to thank you for this great piece of work :)
I'm using this in one of my current projects in a playground and found a bug? while playing around. I'm not sure if it really is a bug, it might be also just a misunderstanding of how this library works.

var objArray = [
    { Name: "John", Id: 0, Salary: 1300.00, Company: "Microsoft" },
    { Name: "Peter", Id: 1, Salary: 4800.50, Company: "Microsoft" },
    { Name: "Sandra", Id: 2, Salary: 999.99, Company: "Microsoft" },
    { Name: "Me", Id: 3, Salary: 1000000000.00, Company: "Hell Corp." }
];
var groups = Linq.from(objArray).groupBy(x => x.Company, x => x);
var companies = groups.select(x => x.key).toArray();
console.log('Companies: ' + companies.toString());

This works fine. But if i want to access the individual groups it doesn't work as i expected.

groups.forEach(x =>
{
    var enumerable = new Linq.Enumerable(x.getEnumerator);
    console.log(x.key + ': ' + enumerable.sum(x => x.Salary).toLocaleString())
});

This code in the second line enumerable.sum() causes this error: "too much recursion". It looks like all methods throw this error.
But this works:

groups.forEach(x =>
{
    var sum = 0;
    var enumerator = x.getEnumerator();
    while (enumerator.moveNext()) {
        sum += enumerator.current.Salary;
    }
    console.log(x.key + ': ' + sum.toLocaleString())
});

I'm coming from C# and the first option looks more intuitive. If this is is working as intended this might be a good thing to change? :)

Edit: I tested this in Firefox 41.0.2
In Chrome 46 i get this error: "Uncaught RangeError: Maximum call stack size exceeded"

DateTime

The DateTime class could be very helpful as a replacement or upgrade to the current javascript Date object.

More review

I could really use some help and feedback with the other namespaces.
System
System.Collections
System.Linq

I would love to hear any helpful criticism about their implementation and flagging any missing classes that you really think need to be included.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.