$ 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());
https://github.com/arjun-g/vs-swagger-viewer/blob/894d09b4e0f1dba5c06032e5bea785f18f74017c/src/preview/client.ts#L99
This line makes prepublish fail with:
An easy fix is to coerce this type to
any
. For instance:const parsedYAML = <any>YAML.safeLoad(document.getText());