You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When using api-doc-parser in a Project set up with VueCLI with Typescript, I get the compile error Cannot find name 'Nullable' in the following files:
Add api-doc-parser to dependencies with yarn add @api-platform/api-doc-parser (or npm install @api-platform/api-doc-parser
Add the following code to the generated App.vue file between the <script lang="ts"></script> tags:
import { Component, Vue } from 'vue-property-decorator';
import HelloWorld from './components/HelloWorld.vue';
import parseHydraDocumentation
from '@api-platform/api-doc-parser/lib/hydra/parseHydraDocumentation';
@Component({
components: {
HelloWorld,
},
})
export default class App extends Vue {
async mounted() {
const docs = parseHydraDocumentation('http://localhost:8000/api');
console.log(docs);
}
Run yarn serve (or npm run serve)
The errors show up in the console:
Possible Solution
I managed to work around this issue by creating a global.d.ts file, making sure it is used by deleting the types key in tsconfig.json and adding the following code in global.d.ts:
type Nullable<T> = {
[P in keyof T]: T[P] | null
}
The text was updated successfully, but these errors were encountered:
API Platform version(s) affected: 0.8.2
Description
When using api-doc-parser in a Project set up with VueCLI with Typescript, I get the compile error
Cannot find name 'Nullable'
in the following files:How to reproduce
Add api-doc-parser to dependencies with
yarn add @api-platform/api-doc-parser
(ornpm install @api-platform/api-doc-parser
Add the following code to the generated
App.vue
file between the<script lang="ts"></script>
tags:Run
yarn serve
(ornpm run serve
)The errors show up in the console:
Possible Solution
I managed to work around this issue by creating a
global.d.ts
file, making sure it is used by deleting thetypes
key intsconfig.json
and adding the following code inglobal.d.ts
:The text was updated successfully, but these errors were encountered: