Bridge v1.7 Released

In this version of Bridge, we are thrilled to announce support for the generation of TypeScript definition files for Bridge.NET projects. Now, you can instruct the Bridge C# to JavaScript compiler to emit a d.ts file describing the generated JavaScript in a format ready to consume by TypeScript projects.

This lets you use Bridge output in a TypeScript project, straight away with full static checking, symbol-based navigation, statement completion and code refactoring, provided by Visual Studio.

bridge-typescript

Configuration

Generation of the TypeScript definition files is optional. To activate, add the generateTypeScript configuration property to the bridge.json file.

{
    “output”: “Bridge/output”,
    “generateTypeScript”: true
} 

Compilation

After the Bridge Class Library project is compiled, the output folder contains both the generated JavaScript and the TypeScript definition files. Note, there are two d.ts files:

TypeScript definition Description
[ProjectName].d.ts The TypeScript definition that matches the project’s generated JavaScript. The file is named after the project name, by default. Demo.d.ts for a project with name Demo, for example.
bridge.d.ts The TypeScript definition for the main Bridge JavaScript file (bridge.js). This file is referenced by every other d.ts file emitted by the Bridge compiler.

The screenshot below shows the contents of the output folder after the Bridge project has been successfully compiled.

d.ts files

Deployment

To use the generated TypeScript definition in a TypeScript project, add a reference in any ts file, for example:

HTMLapp.ts
/// <reference path=”Bridge/output/demo.d.ts” /> 

This will let you take advantage of all TypeScript goodness as the screenshot below illustrates.

typescript-goodness

TypeScript Unit Tests

All Bridge features are unit tested and so is TypeScript support. There are 193 tests already added to the public Bridge.NET testing repository. They cover everything from TypeScript basic types and functions to interfaces and generics and their results can be viewed online at testing.bridge.net.

TypeScript Unit TestsTypeScript support in Bridge.NET is a new feature of paramount importance, and allows you to have the best of both worlds: C# and typed JavaScript, with your code immediately usable from TypeScript!

Greater IE8 Support

The version 1.7.0 release also includes greater support for Internet Explorer 8. Even though it is very hard to cater for legacy browser versions without compromising the functionality of new features, this was specifically asked by community members both in the forums and the GitHub so we’ve decided to run some tests and make the necessary changes to have Bridge work better there, too.

More Information

Download

CDN : bridge.js or bridge.min.js

Official Release stamp in GitHub

Comparing v1.6 vs v1.7 changes

18 Defects Fixed

3 New Features Added

Leave a Reply

Your email address will not be published. Required fields are marked *

Markdown and code formatting supported in comments, including use of code formatting shortcodes ([cs], [js], [code], [html])