Only promise what we can deliver regarding IntelliSense

This commit is contained in:
ahocevar
2019-02-10 09:02:11 +01:00
parent f6e625f21a
commit 3ef6635c09

View File

@@ -41,27 +41,25 @@ See the following examples for more detail on bundling OpenLayers with your appl
* Using [Parcel](https://github.com/openlayers/ol-parcel) * Using [Parcel](https://github.com/openlayers/ol-parcel)
* Using [Browserify](https://github.com/openlayers/ol-browserify) * Using [Browserify](https://github.com/openlayers/ol-browserify)
## TypeScript and VS Code IntelliSense support ## IntelliSense support and type checking for VS Code
The `ol` package contains a `src/` folder with JSDoc annotated sources. TypeScript can get type definitions from these sources with a `tsconfig.json` like this: The `ol` package contains a `src/` folder with JSDoc annotated sources. TypeScript can get type definitions from these sources with a `jsconfig.json` config file in the project root:
```js ```js
{ {
"compilerOptions": { "compilerOptions": {
// Enable JavaScript support "checkJs": true,
"allowJs": true,
// Point to the JSDoc typed sources when using modules from the ol package // Point to the JSDoc typed sources when using modules from the ol package
"baseUrl": "./", "baseUrl": "./",
"paths": { "paths": {
"ol": ["node_modules/ol/src"], "ol": ["node_modules/ol/src"],
"ol/*": ["node_modules/ol/src/*"] "ol/*": ["node_modules/ol/src/*"]
} }
}, }
"include": [
// Include JavaScript files from the ol package
"node_modules/ol/**/*.js"
]
} }
``` ```
Project template with this configuration: https://gist.github.com/9a7253cb4712e8bf38d75d8ac898e36c.
Note that the above only works when authoring in plain JavaScript. For similar configurations with a `tsconfig.json` in TypeScript projects, your mileage may vary.
## Supported Browsers ## Supported Browsers