Skip to content

Commit

Permalink
Fix external import with same member name
Browse files Browse the repository at this point in the history
  • Loading branch information
hanreev committed Jul 1, 2019
1 parent 60eca3a commit 58ced4f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 30 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
],
"quotes": [
"error",
"single"
"single",
{
"allowTemplateLiterals": true
}
],
"semi": [
"error",
Expand Down
3 changes: 2 additions & 1 deletion @types/ol/format/GeoJSON.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Feature,
FeatureCollection,
GeoJSON as GeoJSON_1,
Geometry,
GeometryCollection,
LineString,
Expand Down Expand Up @@ -30,7 +31,7 @@ export type GeoJSONLineString = LineString;
export type GeoJSONMultiLineString = MultiLineString;
export type GeoJSONMultiPoint = MultiPoint;
export type GeoJSONMultiPolygon = MultiPolygon;
export type GeoJSONObject = GeoJSON;
export type GeoJSONObject = GeoJSON_1;
export type GeoJSONPoint = Point;
export type GeoJSONPolygon = Polygon;
export interface Options {
Expand Down
30 changes: 5 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ There are several ways to use this package. Please choose one:
...
"devDependencies": {
...
"@hanreev/types-ol": "^2.0.5",
"@hanreev/types-ol": "^2.0.6",
"@types/ol": "file:node_modules/@hanreev/types-ol/ol",
...
}
Expand Down Expand Up @@ -71,29 +71,6 @@ There are several ways to use this package. Please choose one:
}
```

- Using `compilerOptions.typeRoots` and `compilerOptions.types` in `tsconfig.json`

```js
// file: tsconfig.json

{
"compilerOptions": {
...
"baseUrl": "./",
"typeRoots": [
"node_modules/@types",
"node_modules/@hanreev/types-ol"
],
"types": [
"ol",
...
],
...
}
}
```




## Configuring and Building TypeScript declaration files
Expand Down Expand Up @@ -156,11 +133,14 @@ Configuration is located at `jsdoc/conf.json`

## Changelog

- **v2.0.6**
- Fix external import with same member name--e.g., `GeoJSON` from `geojson` module in `ol/format/GeoJSON`
- Order module members by kind
- **v2.0.5**
- Fix anonymous function parameters type
- Fix union types
- **v2.0.4**
- Fix optional parameters in function type. Ex: third parameter of `{function(*, Array<*>, string=): (Node|undefined)}`
- Fix optional parameters in function type--e.g., third parameter of `{function(*, Array<*>, string=): (Node|undefined)}`
- Test files fixes
- **v2.0.3**
- OpenLayers 5.3.3 source
Expand Down
4 changes: 2 additions & 2 deletions jsdoc/template/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function registerImport(_module, val) {

let doclet = find({ longname: val })[0];

if (!doclet) {
if (!doclet && moduleName.startsWith('ol')) {
doclet = find({ name: importName, memberof: _module.longname })[0];
if (doclet)
return importName;
Expand Down Expand Up @@ -373,7 +373,7 @@ function stringifyType(parsedType, _module, undefinedLiteral = true) {
params = functionType.params.map((param, i) => {
let name = `p${i}`;
if (param.optional) name += '?';
return `${name}: ${stringifyType(param, _module, false)}`
return `${name}: ${stringifyType(param, _module, false)}`;
});

if (functionType.this)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hanreev/types-ol",
"version": "2.0.5",
"version": "2.0.6",
"description": "OpenLayers 5+ TypeScript declaration",
"author": "Rifa'i M. Hanif <[email protected]>",
"repository": {
Expand Down

0 comments on commit 58ced4f

Please sign in to comment.