Documentation is not compatible with Typescript
See original GitHub issueExpected Behavior
As a developer I expect the documentation to contain working snippets/guides.
Actual Behavior
Several guides and snippets are incompatible with the typings.
Possible Solution
One of the points listed could resolve this issue.
- Documentation should reflect the actual API
- Typescript should have a better documentation
- Typings should handle required and optional properties correctly
Ugly workaround
The only way to use the API is to fool typescript via as
.
space.createContentType({
name: "Foo",
fields: [],
} as Omit<ContentTypeProps, "sys">)
Steps to Reproduce
The example below is just one of several cases. In general it seems like several methods are not typed correctly, making this library incompatible with typescript environments.
- Go to https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types/content-type-collection/create-a-content-type/console/js
- Go to: https://github.com/contentful/contentful-management.js/blob/c4a7e33eda7c2dea6fd3357420ec0be5652e9de8/lib/create-environment-api.ts#L272
- The examples or typings are wrong (See: code comments and contentful.com/docs)
displayType
and description
are required in ContentTypeProps
since only sys
is omitted via:
Omit<ContentTypeProps, "sys">
As mentioned there are likely several of these issues.
Context
The library is incompatible with typescript.
Environment
- Language Version: v12.15.0
- Package Manager Version: yarn 1.22.4
- Browser Version:
- Operating System: Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
- Package Version: 5.27.1
- Which API are you using?: Management
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Documentation - Type Compatibility - TypeScript
Type compatibility in TypeScript is based on structural subtyping. ... When a type system has this property, it is said to not be...
Read more >What do you not like about the TypeScript Website ... - GitHub
What do you not like about the TypeScript Website and Documentation? Hey folks, we, the TypeScript team at Microsoft, are planning a full ......
Read more >Documenting Your TypeScript Projects: There Are Options
Documenting Your TypeScript Projects: There Are Options · Good code does not need documentation · TypeDoc: here to solve all your problems.
Read more >Documentation lists the incorrect compatible version of ...
Open this URL TypeScript | SonarQube Docs run a Sonar sca… ... [ERROR] You are using version of TypeScript 3.1.6 which is not...
Read more >TypeScript configuration - Angular
Many libraries —jQuery, Jasmine, and Lodash among them— do not include d.ts files in their npm packages. Fortunately, either their authors or community ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@suevalov you are right about
ContentFields
, I missed theextends Item
, I still had an error in that section, will report back tomorrow.🎉 This issue has been resolved in version 5.27.3 🎉
The release is available on:
Your semantic-release bot 📦🚀