Skip to content

Instantly share code, notes, and snippets.

@cedricss
Last active July 3, 2016 14:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cedricss/e41f60fdcf6ca5c31ea0 to your computer and use it in GitHub Desktop.
Save cedricss/e41f60fdcf6ca5c31ea0 to your computer and use it in GitHub Desktop.

Type Inference

var number = 15;
var word = "Hello";
var strNumber = 15+" 1";

number.
word.
strNumber.

Wakanda API

var folder = Folder("PROJECT");

folder.forEachFolder(function(folder) {
	folder.
})

Model

In this example we use a Task and an Attachment Class. There is a 1>n relation between a task and attachements.

Infinite autocompletion

var attachment = ds.Attachment.createEntity(); // ds.Attachment.cey ==autocompletion==> createEntity()
	
attachment.task.attachments.forEach(function(attachement) {
  attachment.task.attachments.first().
}) 


function handler(request, response){
	var user = currentUser();
	return user.fullName;
}

Type Array

var result = ds.Attachment.query("ID =:1", 15);

result[15].

ES6

Modules/heroes.js

export class Hero {

	constructor(){
		// Autocompletion on this :
		this.hello();
		this.prop = 15;
	}
	
	hello(){
	
	}
	
	get prop(){
	
	}
	
	set prop(){
	
	}
}

test.js

import * as heroes from 'heroes'
var Batman = new heroes.Hero();
Batman.

Typescript

Modules/foo.ts

export class Foo {}
export interface IFoo {}

bar.ts

import fooModule = require("Foo");
fooModule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment