svelte2tsx 0.6.12 → 0.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +6 -0
- package/index.js +9 -7
- package/index.mjs +9 -7
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export interface SvelteCompiledToTsx {
|
|
|
4
4
|
code: string;
|
|
5
5
|
map: import("magic-string").SourceMap;
|
|
6
6
|
exportedNames: IExportedNames;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use TypeScript's `TypeChecker` to get the type information instead. This only covers literal typings.
|
|
9
|
+
*/
|
|
7
10
|
events: ComponentEvents;
|
|
8
11
|
}
|
|
9
12
|
|
|
@@ -11,6 +14,9 @@ export interface IExportedNames {
|
|
|
11
14
|
has(name: string): boolean;
|
|
12
15
|
}
|
|
13
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use TypeScript's `TypeChecker` to get the type information instead. This only covers literal typings.
|
|
19
|
+
*/
|
|
14
20
|
export interface ComponentEvents {
|
|
15
21
|
getAll(): { name: string; type: string; doc?: string }[];
|
|
16
22
|
}
|
package/index.js
CHANGED
|
@@ -3324,18 +3324,20 @@ class ComponentEventsFromEventsMap {
|
|
|
3324
3324
|
return;
|
|
3325
3325
|
}
|
|
3326
3326
|
const { dispatcherTyping, dispatcherName } = result;
|
|
3327
|
-
if (dispatcherTyping
|
|
3327
|
+
if (dispatcherTyping) {
|
|
3328
3328
|
this.eventDispatchers.push({
|
|
3329
3329
|
name: dispatcherName,
|
|
3330
3330
|
typing: dispatcherTyping.getText()
|
|
3331
3331
|
});
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3332
|
+
if (ts.isTypeLiteralNode(dispatcherTyping)) {
|
|
3333
|
+
dispatcherTyping.members.filter(ts.isPropertySignature).forEach((member) => {
|
|
3334
|
+
var _a;
|
|
3335
|
+
this.addToEvents(getName(member.name), {
|
|
3336
|
+
type: `CustomEvent<${((_a = member.type) === null || _a === void 0 ? void 0 : _a.getText()) || 'any'}>`,
|
|
3337
|
+
doc: getDoc(member)
|
|
3338
|
+
});
|
|
3337
3339
|
});
|
|
3338
|
-
}
|
|
3340
|
+
}
|
|
3339
3341
|
}
|
|
3340
3342
|
else {
|
|
3341
3343
|
this.eventDispatchers.push({ name: dispatcherName });
|
package/index.mjs
CHANGED
|
@@ -3304,18 +3304,20 @@ class ComponentEventsFromEventsMap {
|
|
|
3304
3304
|
return;
|
|
3305
3305
|
}
|
|
3306
3306
|
const { dispatcherTyping, dispatcherName } = result;
|
|
3307
|
-
if (dispatcherTyping
|
|
3307
|
+
if (dispatcherTyping) {
|
|
3308
3308
|
this.eventDispatchers.push({
|
|
3309
3309
|
name: dispatcherName,
|
|
3310
3310
|
typing: dispatcherTyping.getText()
|
|
3311
3311
|
});
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3312
|
+
if (ts.isTypeLiteralNode(dispatcherTyping)) {
|
|
3313
|
+
dispatcherTyping.members.filter(ts.isPropertySignature).forEach((member) => {
|
|
3314
|
+
var _a;
|
|
3315
|
+
this.addToEvents(getName(member.name), {
|
|
3316
|
+
type: `CustomEvent<${((_a = member.type) === null || _a === void 0 ? void 0 : _a.getText()) || 'any'}>`,
|
|
3317
|
+
doc: getDoc(member)
|
|
3318
|
+
});
|
|
3317
3319
|
});
|
|
3318
|
-
}
|
|
3320
|
+
}
|
|
3319
3321
|
}
|
|
3320
3322
|
else {
|
|
3321
3323
|
this.eventDispatchers.push({ name: dispatcherName });
|