Opt-out instead of opt-in for included types
This commit is contained in:
15
README.md
15
README.md
@@ -105,20 +105,7 @@ The untranspiled sources in the `src/` folder are JSDoc type annotated. For appl
|
|||||||
|
|
||||||
## TypeScript support
|
## TypeScript support
|
||||||
|
|
||||||
When authoring in TypeScript, we recommend you try out the types that are included in the `ol` package. To use these types, add the following entry for `@types/ol` to your `package.json`'s `devDependencies` section:
|
The [ol package](https://npmjs.com/package/ol) includes auto-generated TypeScript declarations as `*.d.ts` files.
|
||||||
```
|
|
||||||
{
|
|
||||||
...
|
|
||||||
"devDependencies": {
|
|
||||||
...
|
|
||||||
"@types/ol": "file:node_modules/ol/types",
|
|
||||||
...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
Make sure to run `npm install` before and after adding that entry.
|
|
||||||
|
|
||||||
These types are auto-generated by the TypeScript compiler, and will be the only type source in future versions. For now, you can still use third-party types from [Definitely Typed](https://definitelytyped.org) (`npm install @types/ol`) or from [hanreev/types-ol](https://github.com/hanreev/types-ol).
|
|
||||||
|
|
||||||
## Supported Browsers
|
## Supported Browsers
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
### Next version
|
### Next version
|
||||||
|
|
||||||
|
#### Included TypeScript declarations
|
||||||
|
|
||||||
|
The [ol package](https://npmjs.com/package/ol) now includes TypeScript declarations as `*.d.ts` files.
|
||||||
|
|
||||||
|
If desired, e.g. when you don't want to adjust your code after upgrading from a previous version where you used `@types/ol`, you can opt out of the included types and use third-party types by specifying aliases in the `compilerOptions` section of `tsconfig.json`, e.g.
|
||||||
|
```json
|
||||||
|
"baseUrl": "./",
|
||||||
|
"paths": {
|
||||||
|
"ol": ["node_modules/@types/ol"],
|
||||||
|
"ol/*": ["node_modules/@types/ol/*"]
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
#### Deprecation of `image` render mode for vector tile layers
|
#### Deprecation of `image` render mode for vector tile layers
|
||||||
|
|
||||||
`renderMode: 'image'` for vector tile layers has been deprecated. Applications continue to work, but a warning will be issued to the console. To get rid of the warning, simply remove the `renderMode` option.
|
`renderMode: 'image'` for vector tile layers has been deprecated. Applications continue to work, but a warning will be issued to the console. To get rid of the warning, simply remove the `renderMode` option.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"build-legacy": "shx rm -rf build/legacy && npm run build-index && webpack --config config/webpack-config-legacy-build.js && cleancss --source-map src/ol/ol.css -o build/legacy/ol.css",
|
"build-legacy": "shx rm -rf build/legacy && npm run build-index && webpack --config config/webpack-config-legacy-build.js && cleancss --source-map src/ol/ol.css -o build/legacy/ol.css",
|
||||||
"build-site": "npm run build-examples && npm run apidoc && mkdir -p build/site && cp site/index.html build/site && mv build/apidoc build/site/apidoc && mv build/examples build/site/examples",
|
"build-site": "npm run build-examples && npm run apidoc && mkdir -p build/site && cp site/index.html build/site && mv build/apidoc build/site/apidoc && mv build/examples build/site/examples",
|
||||||
"copy-css": "shx cp src/ol/ol.css build/ol/ol.css",
|
"copy-css": "shx cp src/ol/ol.css build/ol/ol.css",
|
||||||
"generate-types": "npx --package=typescript@3.8.3 -y -- tsc --project config/tsconfig-build.json --declaration --declarationMap --emitDeclarationOnly --outdir build/ol/types",
|
"generate-types": "npx --package=typescript@3.8.3 -y -- tsc --project config/tsconfig-build.json --declaration --declarationMap --emitDeclarationOnly --outdir build/ol",
|
||||||
"transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build/ol/src && node tasks/serialize-workers.cjs && npx --package=typescript@4.3.5 -y -- tsc --project config/tsconfig-build.json",
|
"transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build/ol/src && node tasks/serialize-workers.cjs && npx --package=typescript@4.3.5 -y -- tsc --project config/tsconfig-build.json",
|
||||||
"typecheck": "npx --package=typescript@4.3.5 -y -- tsc --pretty",
|
"typecheck": "npx --package=typescript@4.3.5 -y -- tsc --pretty",
|
||||||
"apidoc-debug": "shx rm -rf build/apidoc && node --inspect-brk=9229 ./node_modules/jsdoc/jsdoc.js -R config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc",
|
"apidoc-debug": "shx rm -rf build/apidoc && node --inspect-brk=9229 ./node_modules/jsdoc/jsdoc.js -R config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc",
|
||||||
|
|||||||
Reference in New Issue
Block a user