Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The definition source of createClient is the one that has been deprecated. #1701

Closed
yanachuwan9sm opened this issue Feb 21, 2023 · 3 comments

Comments

@yanachuwan9sm
Copy link

yanachuwan9sm commented Feb 21, 2023

Hi.
As the title suggests.
It seems to be oriented towards the deprecated source of the createClient definition, even though the second argument is not passed.👋

The following is a following the README of contentful-typescript-codegen
The code for getContentfulEnvironment.js created in the root of the project.

image

As you can see below, is it possible that @deprecated is affecting the overload?
I felt that Is this a phenomenon that I am the only one reproducing?

(If so, I felt it necessary to review the VSCode settings, etc.)

microsoft/tsdoc#131

Also, by modifying contentful-management.d.ts as follows
The definition source is now oriented to the createClient, which can be expected.
(I don't think this is in line with best practice, but... ,)

I am not very knowledgeable in this area, so please can someone lend me their knowledge🙏

/**
 * Create a client instance
 * @param params - Client initialization parameters
 *
 * ```javascript
 * const client = contentfulManagement.createClient({
 *  accessToken: 'myAccessToken'
 * })
 * ```
 */
declare function createClient(params: ClientOptions): ClientAPI;
declare function createClient(params: ClientOptions, opts: {
    type: 'plain';
    defaults?: DefaultParams;
}): PlainClientAPI;

/**
 * @deprecated
 */
export type ClientParams = RestAdapterParams & UserAgentParams;
type ClientOptions = (RestAdapterParams | AdapterParams) & UserAgentParams;
/**
 * @deprecated the alphaFeatures option is not longer supported.
 *
 * {@link Use (createClient:1) (createClient:2) } instead.
 */
declare function createClient(params: ClientOptions, opts: {
    type?: 'plain';
    alphaFeatures: string[];
    defaults?: DefaultParams;
}): ClientAPI | PlainClientAPI;

Versions are as follows:
"contentful-management": "10.29.4"

[imo]

I also thought that @deprecated should include a recommendation of what should be used instead, so I thought we should follow convention.

@filipposwift
Copy link

I'm having the some problem with:
"contentful-management": "^10.34.1"
Any fix or suggestions?

@Chaoste
Copy link
Contributor

Chaoste commented May 26, 2023

Hello everyone, thanks for bringing this up. It appears that this is an error in the IDE and we found a way to mitigate this. There is a more detailed explanation in the linked PR. As recommended by you, I adjusted the warning so that is "followed by a sentence describing the recommended alternative". It doesn't say that one should link to another function and I found it not very intuitive to link to other overloads, so I decided to leave that out and describe with words what one should do.

@Chaoste
Copy link
Contributor

Chaoste commented May 31, 2023

The issue should be fixed starting with version 10.35.6. I will close this issue but feel free to reach out if you still face similar issues.

@Chaoste Chaoste closed this as completed May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants