mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add typings for mongoose-geojson-schema (#21028)
* Add typings fro mongoose-geojson-schema * Fix lint errors
This commit is contained in:
parent
57989134a3
commit
e063f03d60
79
types/mongoose-geojson-schema/index.d.ts
vendored
Normal file
79
types/mongoose-geojson-schema/index.d.ts
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
// Type definitions for mongoose-geojson-schema 2.1
|
||||
// Project: https://github.com/rideamigoscorp/mongoose-geojson-schema#readme
|
||||
// Definitions by: Bond <https://github.com/bondz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import mongoose = require('mongoose');
|
||||
|
||||
declare module 'mongoose' {
|
||||
namespace Schema {
|
||||
namespace Types {
|
||||
class GeoJSON extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'GeoJSON';
|
||||
}
|
||||
|
||||
class Point extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'Point';
|
||||
}
|
||||
|
||||
class MultiPoint extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'MultiPoint';
|
||||
}
|
||||
|
||||
class LineString extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'LineString';
|
||||
}
|
||||
|
||||
class MultiLineString extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'MultiLineString';
|
||||
}
|
||||
|
||||
class Polygon extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'Polygon';
|
||||
}
|
||||
|
||||
class MultiPolygon extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'MultiPolygon';
|
||||
}
|
||||
|
||||
class Geometry extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'Geometry';
|
||||
}
|
||||
|
||||
class GeometryCollection extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'GeometryCollection';
|
||||
}
|
||||
|
||||
class Feature extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'Feature';
|
||||
}
|
||||
|
||||
class FeatureCollection extends SchemaType {
|
||||
constructor(key: string, options?: object);
|
||||
cast(geojson: object): this;
|
||||
static schemaName: 'FeatureCollection';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
import * as mongoose from 'mongoose';
|
||||
import * as mongooseGeoJSONSchema from 'mongoose-geojson-schema';
|
||||
|
||||
const TestSchema = new mongoose.Schema(
|
||||
{
|
||||
title: String,
|
||||
test: {},
|
||||
point: mongoose.Schema.Types.Point,
|
||||
multipoint: mongoose.Schema.Types.MultiPoint,
|
||||
linestring: mongoose.Schema.Types.LineString,
|
||||
multilinestring: mongoose.Schema.Types.MultiLineString,
|
||||
polygon: mongoose.Schema.Types.Polygon,
|
||||
multipolygon: mongoose.Schema.Types.MultiPolygon,
|
||||
geometry: mongoose.Schema.Types.Geometry,
|
||||
geometrycollection: mongoose.Schema.Types.GeometryCollection,
|
||||
feature: mongoose.Schema.Types.Feature,
|
||||
featurecollection: mongoose.Schema.Types.FeatureCollection,
|
||||
},
|
||||
{ typeKey: '$type', collection: 'echoes' }
|
||||
);
|
||||
23
types/mongoose-geojson-schema/tsconfig.json
Normal file
23
types/mongoose-geojson-schema/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mongoose-geojson-schema-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/mongoose-geojson-schema/tslint.json
Normal file
1
types/mongoose-geojson-schema/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user