kontent-ai / model-generator-js

MIT License
13 stars 9 forks source link

Generating models fails - Type 'IContentItem' is not generic.ts #20

Closed Simply007 closed 2 years ago

Simply007 commented 2 years ago

Brief bug description

I have generated the models and they looks as described in readme.

import { IContentItem, Elements } from '@kentico/kontent-delivery';

/**
 * Generated by '@kentico/kontent-model-generator@4.0.0' at 'Tue, 23 Nov 2021 17:18:24 GMT'
 */
export type Stat = IContentItem<{
  link_text: Elements.TextElement;
  metric: Elements.TextElement;
  link_url: Elements.TextElement;
  description: Elements.TextElement;
  note: Elements.TextElement;
}>;

But my compiler is complaining:

Type 'IContentItem' is not generic.ts(2315)
(alias) interface IContentItem
import IContentItem

Repro steps

  1. Generate any model
  2. Run TS compilation/lint

Expected behavior

No error should be raised.

Screenshots

image

Enngage commented 2 years ago

@Simply007 As this is only generator, it does not provide IContentItem interface. Does your repo have Delivery JS SDK on version 11.0.0 installed?

Simply007 commented 2 years ago

@Simply007 As this is only generator, it does not provide IContentItem interface. Does your repo have Delivery JS SDK on version 11.0.0 installed?

My fault!

I have set the SDK version to v11, removed package-lock.json, and ran npm install. Unfortunately, I haven't saved the package.json 🤦‍♂️