Skip to content

Instantly share code, notes, and snippets.

"use strict"
class ErrorBox {
constructor(div, gate) {
this.div = div;
console.log(div); //Output some instance
gate.addEventListener(this.gateListener);
}
gateListener(e) {
console.log(this.div); //Output undefined

Proposed module resolution strategy

Proposed set of rules is an extension to baseUrl based mechanics used by RequireJS or SystemJS.

Core elements of the system are baseUrl and path mappings. Resolution process describes how they are used together.

BaseUrl

All non-rooted paths are computed relative to baseUrl. Value of baseUrl is determined as either:

Proposed module resolution strategy

Proposed set of rules is an extension to baseUrl based mechanics used by RequireJS or SystemJS.

Core elements of the system are baseUrl and path mappings. Resolution process describes how they are used together.

BaseUrl

All non-rooted paths are computed relative to baseUrl. Value of baseUrl is determined as either:

let data = []
for (let x = 0; x < 5;) {
data.push(() => x);
x++
}
This file has been truncated, but you can view the full file.
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
import {Observable} from "rxjs/rx";
Observable
.of(1)
.catch(e => Observable.of("error"))
.map(x => x.toFixed());
"use strict";
var ts = require('typescript');
console.log(ts.SyntaxKind.CallExpression);
import * as ts from "typescript";
// Note: this uses ts.formatting which is part of the typescript 1.4 package but is not currently
// exposed in the public typescript.d.ts. The typings should be exposed in the next release.
function format(text: string) {
let options = getDefaultOptions();
// Parse the source text
let sourceFile = ts.createSourceFile("file.ts", text, ts.ScriptTarget.Latest, /*setParentPointers*/ true);
import * as ts from "typescript";
const fileName = "test.ts";
const program = ts.createProgram([fileName], {});
const typeChecker = program.getTypeChecker();
const file = program.getSourceFile(fileName);
// use getSignatureFromDeclaration
{
const ctorDecl = ts.forEachChild(file, function find(n) {
define(["require", "exports"], function (require, exports) {
"use strict";
exports.x = 12;
require("./a");
});