From 939bf16689c3d3ebf18adf3310aa2ce89efb289d Mon Sep 17 00:00:00 2001 From: tkqubo Date: Mon, 4 Jan 2016 22:31:29 +0900 Subject: [PATCH 1/5] feat: osmtogeojson --- osmtogeojson/osmtogeojson-tests.ts | 94 +++++++++++++++++++++++++++++ osmtogeojson/osmtogeojson.d.ts | 96 ++++++++++++++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 osmtogeojson/osmtogeojson-tests.ts create mode 100644 osmtogeojson/osmtogeojson.d.ts diff --git a/osmtogeojson/osmtogeojson-tests.ts b/osmtogeojson/osmtogeojson-tests.ts new file mode 100644 index 000000000..3bb83c100 --- /dev/null +++ b/osmtogeojson/osmtogeojson-tests.ts @@ -0,0 +1,94 @@ +/// + +import osmtogeojson from 'osmtogeojson'; +import {OsmJSON, GeoJSON} from 'osmtogeojson'; + +let xml: Document = (new DOMParser()).parseFromString("", 'text/xml'); +let geojson: GeoJSON.FeatureCollection = { + type: "FeatureCollection", + features: [ + { + type: "Feature", + id: "node/1", + properties: { + type: "node", + id: 1, + tags: {}, + relations: [], + meta: {} + }, + geometry: { + type: "Point", + coordinates: [4.321, 1.234] + } + } + ] +}; + +osmtogeojson.toGeojson(xml); +osmtogeojson(xml, { + flatProperties: true, + uninterestingTags: {foo:true} +}); + +let json: OsmJSON.Root = { + elements: [ + { + type: "node", + id: 1, + lat: 1.234, + lon: 4.321, + timestamp: "2013-01-13T22:56:07Z", + version: 7, + changeset: 1234, + user: "johndoe", + uid: 666 + }, + { + type: "relation", + tags: {"type": "multipolygon"}, + id: 1, + members: [ + { + type: "way", + ref: 2, + role: "outer" + }, + { + type: "way", + ref: 3, + role: "outer" + } + ] + }, + { + type: "way", + id: 2, + nodes: [4,5,6,4] + }, + { + type: "node", + id: 4, + lat: 0.0, + lon: 0.0 + }, + { + type: "node", + id: 5, + lat: 0.0, + lon: 1.0 + }, + { + type: "node", + id: 6, + lat: 1.0, + lon: 0.0 + } + ] +}; + +osmtogeojson.toGeojson(json); +osmtogeojson(json, { + flatProperties: true, + uninterestingTags: {foo:true} +}); diff --git a/osmtogeojson/osmtogeojson.d.ts b/osmtogeojson/osmtogeojson.d.ts new file mode 100644 index 000000000..0edee3509 --- /dev/null +++ b/osmtogeojson/osmtogeojson.d.ts @@ -0,0 +1,96 @@ +// Type definitions for osmtogeojson 2.2.5 +// Project: https://github.com/tyrasd/osmtogeojson.git +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "osmtogeojson" { + export interface OsmToGeoJSON { + (data: Document|OsmJSON.Root, options?: Options): GeoJSON.GeoJSONObject; + toGeojson(data: Document|OsmJSON.Root, options?: Options): GeoJSON.GeoJSONObject; + } + + export interface Options { + verbose?: boolean; + /** + * If true, the resulting GeoJSON feature's properties will be a simple key-value list instead of a structured json object (with separate tags and metadata). default: false + */ + flatProperties?: boolean; + /** + * Either a blacklist of tag keys or a callback function. Will be used to decide if a feature is interesting enough for its own GeoJSON feature. + */ + uninterestingTags?: { [tag: string]: boolean; }|Function; //TODO: type function + /** + * Either a json object or callback function that is used to determine if a closed way should be treated as a Polygon or LineString. + */ + polygonFeatures?: any|Function; //TODO: type this + } + + export namespace GeoJSON { + export interface GeoJSONObject { + type: string; + } + + export interface Feature extends GeoJSONObject { + id?: string; + geometry: Geometry; + properties: any; //TODO: type this + } + + export interface FeatureCollection extends GeoJSONObject { + features: Feature[]; + } + + export interface Geometry extends GeoJSONObject { + coordinates: Coordinate|Coordinate[]|Coordinate[][]; + } + + export interface GeometryCollection extends GeoJSONObject { + geometries: Geometry[]; + } + + export type Coordinate2d = [number, number]; + export type Coordinate3d = [number, number, number]; + export type Coordinate = Coordinate2d|Coordinate3d; + } + + export namespace OsmJSON { + export interface Root { + elements: (Node|Way|Relationship)[]; + } + + export interface OsmJSONObject { + type: string; + id: number; + tags?: { [name: string]: string; } + timestamp?: string; + version?: number; + changeset?: number; + user?: string; + uid?: number; + } + + export interface Node extends OsmJSONObject { + lat: number; + lon: number; + } + + export interface Way extends OsmJSONObject { + nodes: number[]; + } + + export interface Relationship extends OsmJSONObject { + members: Member[]; + } + + export interface Member { + type: string; + ref: number; + role: string; + } + } + + var osmtogeojson: OsmToGeoJSON; + + export default osmtogeojson; +} + From 811fc834c743e52fbc5acc9f97b9de27a31afe3e Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 5 Jan 2016 00:39:30 +0900 Subject: [PATCH 2/5] Add osmtogeojson --- osmtogeojson/osmtogeojson-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osmtogeojson/osmtogeojson-tests.ts b/osmtogeojson/osmtogeojson-tests.ts index 3bb83c100..a4debe4c1 100644 --- a/osmtogeojson/osmtogeojson-tests.ts +++ b/osmtogeojson/osmtogeojson-tests.ts @@ -1,9 +1,11 @@ /// +/// import osmtogeojson from 'osmtogeojson'; import {OsmJSON, GeoJSON} from 'osmtogeojson'; +import * as xmldom from 'xmldom'; -let xml: Document = (new DOMParser()).parseFromString("", 'text/xml'); +let xml: Document = (new xmldom.DOMParser()).parseFromString("", 'text/xml'); let geojson: GeoJSON.FeatureCollection = { type: "FeatureCollection", features: [ From d93a96c3eff416144ea3d989eddf0af62fd53d7c Mon Sep 17 00:00:00 2001 From: Niko Kovacic Date: Fri, 8 Jan 2016 11:36:35 +0100 Subject: [PATCH 3/5] Added ui-select to TypeScript definitions --- ui-select/ui-select-tests.ts | 9 +++++++++ ui-select/ui-select.d.ts | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 ui-select/ui-select-tests.ts create mode 100644 ui-select/ui-select.d.ts diff --git a/ui-select/ui-select-tests.ts b/ui-select/ui-select-tests.ts new file mode 100644 index 000000000..e0017576f --- /dev/null +++ b/ui-select/ui-select-tests.ts @@ -0,0 +1,9 @@ +/// + +angular + .module('main', ['ui-select']) + .config(function(uiSelectConfig: angular.ui.select.ISelectConfig) { + uiSelectConfig.appendToBody = true; + uiSelectConfig.resetSearchInput = true; + uiSelectConfig.theme = "bootstrap"; + }); \ No newline at end of file diff --git a/ui-select/ui-select.d.ts b/ui-select/ui-select.d.ts new file mode 100644 index 000000000..e223b947e --- /dev/null +++ b/ui-select/ui-select.d.ts @@ -0,0 +1,19 @@ +// Type definitions for ui-select 0.13.2 +// Project: https://github.com/angular-ui/ui-select +// Definitions by: Niko Kovačič +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "ui-select" { + var _: string; + export = _; +} + +declare module angular.ui.select { + interface ISelectConfig { + appendToBody: boolean; + resetSearchInput: boolean; + theme: string; + } +} From e64dec93fead201b2a961bd17382b9a44f131277 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 8 Jan 2016 16:35:30 +0500 Subject: [PATCH 4/5] lodash: signatures of _.isPlainObject have been changed --- lodash/lodash-tests.ts | 22 ++++++++++++++++++---- lodash/lodash.d.ts | 7 +++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2..5544a0b98 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6106,10 +6106,24 @@ module TestIsObject { } // _.isPlainObject -result = _.isPlainObject(any); -result = _(1).isPlainObject(); -result = _([]).isPlainObject(); -result = _({}).isPlainObject(); +module TestIsPlainObject { + { + let result: boolean; + + result = _.isPlainObject(any); + result = _(1).isPlainObject(); + result = _([]).isPlainObject(); + result = _({}).isPlainObject(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isPlainObject(); + result = _([]).chain().isPlainObject(); + result = _({}).chain().isPlainObject(); + } +} // _.isRegExp module TestIsRegExp { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90ee..0214c2d96 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10154,6 +10154,13 @@ declare module _ { isPlainObject(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): LoDashExplicitWrapper; + } + //_.isRegExp interface LoDashStatic { /** From 4dd5bea6f4a757c5a993d970bb0da9e28e802d6f Mon Sep 17 00:00:00 2001 From: Samuel Marks Date: Fri, 8 Jan 2016 23:53:19 +1100 Subject: [PATCH 5/5] Next.ifError => https://github.com/restify/node-restify/commit/070725fa3e2b1d7b5e0ec7824b2d1f2d5a713964 --- restify/restify.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 6fb2e6718..a73ca09ba 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -184,6 +184,7 @@ declare module "restify" { interface Next { (err?: any): any; + ifError: (err?: any) => any; } interface RequestHandler {