Face3.d.ts, why an Event interface?

Hello, I’m playing with parsing the d.ts files from the Three.js src to generate C# classes. For the most part, the experiment is going well, but I have some special cases which are popping up.

For example, the Face3.d.ts file for Face3 has an additional Event interface:

export interface Event {
	type: string;
	target?: any;
	[attachment: string]: any;
}

Due to my lack of Typescript or d.ts knowledge, I can’t seem to understand why this interface is in here since I don’t see any events tied to the Face3 object, nor do I see anything in the documentation. Is this interface needed for one of the methods?

BTW, the parsing project is here (the code is a bit of a mess atm).

1 Like

Um, that does not look right. The Event interface is only used in EventDispatcher so it makes more sense to move it to this file.

Thanks! The case that was tripping me up was the [attachment: string]: any; field. I see you took that out.

The problem is that an event object has a target and type property but it can have an arbitrary amount of additional properties like for example data. Event objects like that are not often used though.

However, I’m not sure if [attachment: string]: any; is the correct syntax for defining such types. I think we can leave this out until somebody needs it.

1 Like

Changed my mind. I’ll put [attachment: string]: any; back for now.

1 Like