Missing type coercion makes `npm run vscode:prepublish` fail
tchernobog opened this issue · 0 comments
tchernobog commented
vs-swagger-viewer/src/preview/client.ts
Line 99 in 894d09b
This line makes prepublish fail with:
$ npm run vscode:prepublish
> swagger-viewer@3.0.1 vscode:prepublish /home/matteo/temp/vs-swagger-viewer
> tsc -p ./
src/preview/client.ts:101:30 - error TS2339: Property 'swagger' does not exist on type 'string | object'.
Property 'swagger' does not exist on type 'string'.
101 if (parsedYAML.swagger === "2.0") {
~~~~~~~
src/preview/client.ts:104:28 - error TS2339: Property 'openapi' does not exist on type 'string | object'.
Property 'openapi' does not exist on type 'string'.
104 parsedYAML.openapi &&
~~~~~~~
src/preview/client.ts:105:28 - error TS2339: Property 'openapi' does not exist on type 'string | object'.
Property 'openapi' does not exist on type 'string'.
105 parsedYAML.openapi.match(/^3\.0\.\d(-.+)?$/)
~~~~~~~
Found 3 errors.
An easy fix is to coerce this type to any
. For instance: const parsedYAML = <any>YAML.safeLoad(document.getText());