Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@abdulsattar
Copy link
Contributor

Add Typescript definitions to the API.

@rui-rayqiu
Copy link

LGTM. I'm just curious how we can test this type def somehow?

@kevinv11n
Copy link
Contributor

Have you considered migrating the project to typescript and generating the types export from the source?

@abdulsattar
Copy link
Contributor Author

@kevinv11n done.

// Provides temporary backward compatibility for wire-protocol reform (lwc > 1.5.0). This code
// should be removed once all adapters are migrated to the the API.
const wireAdaptersRegistryHack = global.wireAdaptersRegistryHack || new Map();
const wireAdaptersRegistryHack = (globalThis as any).wireAdaptersRegistryHack || new Map();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is deprecated, so, I didn't add any types for this.

}

function validateAdapterId(adapterId) {
function validateAdapterId(adapterId: any) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions are deprecated, so I just put any everywhere.


it('throws error when no adapter id', () => {
expect(() => {
// @ts-ignore
Copy link

@rui-rayqiu rui-rayqiu Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this because the function is deprecated? Maybe add a comment to explain?

* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/

export interface HttpFetchResponse {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In README there is a type/object called FetchResponse that looks bit different than here. Is it the same type or maybe we need to update README?

@rui-rayqiu
Copy link

LGTM overall with only minor comments. Do you think we need to update README to include an example in TS? Also I'm curious on how did you test this on core or as a consumer of the package?

@abdulsattar abdulsattar merged commit abd8583 into master Oct 25, 2023
@abdulsattar abdulsattar deleted the abdulsattar/add-types branch October 25, 2023 19:58
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

Successfully merging this pull request may close these issues.

4 participants