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

Add Typescript Typing for "selectionChanged" event #1225

Closed
qingwang96 opened this issue Jun 23, 2021 · 5 comments
Closed

Add Typescript Typing for "selectionChanged" event #1225

qingwang96 opened this issue Jun 23, 2021 · 5 comments

Comments

@qingwang96
Copy link

For the "selectionChanged" event on PeoplePicker component and others such as TeamsChannelPicker, the Typescript typing for the event property is not specified past the global React "Event" type.

Could somebody help to clarify the expected event structure in Typescript?

From "react.ts" in generated node_modules:

export type PeoplePickerProps = {
	groupId?: string;
	type?: PersonType;
	groupType?: GroupType;
	transitiveSearch?: boolean;
	people?: IDynamicPerson[];
	selectedPeople?: IDynamicPerson[];
	defaultSelectedUserIds?: string[];
	placeholder?: string;
	selectionMode?: string;
	showMax?: number;
	disabled?: boolean;
	templateContext?: TemplateContext;
	mediaQuery?: ComponentMediaQuery;
	selectionChanged?: (e: Event) => void;
}
@ghost
Copy link

ghost commented Jun 23, 2021

Hello qingwang96, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@vogtn
Copy link
Contributor

vogtn commented Jun 23, 2021

@qingwang96

Yeah seems like there is some limitation with a purely js react custom events.

Here is a quick sample, of what we expect ts:
selectionChangedEvent

And here is the basic structure for all of our CustomEvents. I think you'll mainly be concerned with the "detail" :

protected fireCustomEvent(
eventName: string,
detail?: any,
bubbles: boolean = false,
cancelable: boolean = false
): boolean {
const event = new CustomEvent(eventName, {
bubbles,
cancelable,
detail
});
return this.dispatchEvent(event);
}

Hope this helps in the meantime

@beth-panx
Copy link
Contributor

At the meantime, we should investigate to implement this on mgt.

@vogtn vogtn removed their assignment Oct 7, 2021
@gavinbarron
Copy link
Member

It looks like web component analyzer will support what we need to make this fly in the future based on:
runem/web-component-analyzer#169 and runem/web-component-analyzer#157

I've raised runem/web-component-analyzer#248 to see if this is going to be addressed soon.

@gavinbarron gavinbarron added this to the Future milestone Aug 24, 2022
@gavinbarron gavinbarron moved this to Needs Triage 🔍 in Graph Toolkit Aug 24, 2022
@gavinbarron
Copy link
Member

This was delivered in v3.0

@github-project-automation github-project-automation bot moved this from Needs Triage 🔍 to Done ✔️ in Graph Toolkit Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants