svelte2tsx 0.7.3 → 0.7.4

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.
Files changed (3) hide show
  1. package/index.js +8 -8
  2. package/index.mjs +8 -8
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -4519,7 +4519,7 @@ class ExportedNames {
4519
4519
  else {
4520
4520
  // Create a virtual type alias for the unnamed generic and reuse it for the props return type
4521
4521
  // so that rename, find references etc works seamlessly across components
4522
- this.$props.generic = '$$_sveltets_Props';
4522
+ this.$props.generic = '$$ComponentProps';
4523
4523
  preprendStr(this.str, generic_arg.pos + this.astOffset, `;type ${this.$props.generic} = `);
4524
4524
  this.str.appendLeft(generic_arg.end + this.astOffset, ';');
4525
4525
  this.str.move(generic_arg.pos + this.astOffset, generic_arg.end + this.astOffset, node.parent.pos + this.astOffset);
@@ -4555,11 +4555,11 @@ class ExportedNames {
4555
4555
  if (comment && /\/\*\*[^@]*?@type\s*{\s*{.*}\s*}\s*\*\//.test(comment)) {
4556
4556
  // Create a virtual type alias for the unnamed generic and reuse it for the props return type
4557
4557
  // so that rename, find references etc works seamlessly across components
4558
- this.$props.comment = '/** @type {$$_sveltets_Props} */';
4558
+ this.$props.comment = '/** @type {$$ComponentProps} */';
4559
4559
  const type_start = this.str.original.indexOf('@type', start);
4560
4560
  this.str.overwrite(type_start, type_start + 5, '@typedef');
4561
4561
  const end = this.str.original.indexOf('*/', start);
4562
- this.str.overwrite(end, end + 2, ' $$_sveltets_Props */' + this.$props.comment);
4562
+ this.str.overwrite(end, end + 2, ' $$ComponentProps */' + this.$props.comment);
4563
4563
  }
4564
4564
  else {
4565
4565
  // Complex comment or simple `@type {AType}` comment which we just use as-is.
@@ -4639,16 +4639,16 @@ class ExportedNames {
4639
4639
  // Create a virtual type alias for the unnamed generic and reuse it for the props return type
4640
4640
  // so that rename, find references etc works seamlessly across components
4641
4641
  if (this.isTsFile) {
4642
- this.$props.generic = '$$_sveltets_Props';
4642
+ this.$props.generic = '$$ComponentProps';
4643
4643
  if (props.length > 0 || withUnknown) {
4644
- preprendStr(this.str, node.parent.pos + this.astOffset, surroundWithIgnoreComments(`;type $$_sveltets_Props = ${propsStr};`));
4645
- preprendStr(this.str, node.initializer.expression.end + this.astOffset, `<${this.$props.generic}>`);
4644
+ preprendStr(this.str, node.parent.pos + this.astOffset, surroundWithIgnoreComments(`;type $$ComponentProps = ${propsStr};`));
4645
+ preprendStr(this.str, node.name.end + this.astOffset, `: ${this.$props.generic}`);
4646
4646
  }
4647
4647
  }
4648
4648
  else {
4649
- this.$props.comment = '/** @type {$$_sveltets_Props} */';
4649
+ this.$props.comment = '/** @type {$$ComponentProps} */';
4650
4650
  if (props.length > 0 || withUnknown) {
4651
- preprendStr(this.str, node.pos + this.astOffset, `/** @typedef {${propsStr}} $$_sveltets_Props */${this.$props.comment}`);
4651
+ preprendStr(this.str, node.pos + this.astOffset, `/** @typedef {${propsStr}} $$ComponentProps */${this.$props.comment}`);
4652
4652
  }
4653
4653
  }
4654
4654
  }
package/index.mjs CHANGED
@@ -4499,7 +4499,7 @@ class ExportedNames {
4499
4499
  else {
4500
4500
  // Create a virtual type alias for the unnamed generic and reuse it for the props return type
4501
4501
  // so that rename, find references etc works seamlessly across components
4502
- this.$props.generic = '$$_sveltets_Props';
4502
+ this.$props.generic = '$$ComponentProps';
4503
4503
  preprendStr(this.str, generic_arg.pos + this.astOffset, `;type ${this.$props.generic} = `);
4504
4504
  this.str.appendLeft(generic_arg.end + this.astOffset, ';');
4505
4505
  this.str.move(generic_arg.pos + this.astOffset, generic_arg.end + this.astOffset, node.parent.pos + this.astOffset);
@@ -4535,11 +4535,11 @@ class ExportedNames {
4535
4535
  if (comment && /\/\*\*[^@]*?@type\s*{\s*{.*}\s*}\s*\*\//.test(comment)) {
4536
4536
  // Create a virtual type alias for the unnamed generic and reuse it for the props return type
4537
4537
  // so that rename, find references etc works seamlessly across components
4538
- this.$props.comment = '/** @type {$$_sveltets_Props} */';
4538
+ this.$props.comment = '/** @type {$$ComponentProps} */';
4539
4539
  const type_start = this.str.original.indexOf('@type', start);
4540
4540
  this.str.overwrite(type_start, type_start + 5, '@typedef');
4541
4541
  const end = this.str.original.indexOf('*/', start);
4542
- this.str.overwrite(end, end + 2, ' $$_sveltets_Props */' + this.$props.comment);
4542
+ this.str.overwrite(end, end + 2, ' $$ComponentProps */' + this.$props.comment);
4543
4543
  }
4544
4544
  else {
4545
4545
  // Complex comment or simple `@type {AType}` comment which we just use as-is.
@@ -4619,16 +4619,16 @@ class ExportedNames {
4619
4619
  // Create a virtual type alias for the unnamed generic and reuse it for the props return type
4620
4620
  // so that rename, find references etc works seamlessly across components
4621
4621
  if (this.isTsFile) {
4622
- this.$props.generic = '$$_sveltets_Props';
4622
+ this.$props.generic = '$$ComponentProps';
4623
4623
  if (props.length > 0 || withUnknown) {
4624
- preprendStr(this.str, node.parent.pos + this.astOffset, surroundWithIgnoreComments(`;type $$_sveltets_Props = ${propsStr};`));
4625
- preprendStr(this.str, node.initializer.expression.end + this.astOffset, `<${this.$props.generic}>`);
4624
+ preprendStr(this.str, node.parent.pos + this.astOffset, surroundWithIgnoreComments(`;type $$ComponentProps = ${propsStr};`));
4625
+ preprendStr(this.str, node.name.end + this.astOffset, `: ${this.$props.generic}`);
4626
4626
  }
4627
4627
  }
4628
4628
  else {
4629
- this.$props.comment = '/** @type {$$_sveltets_Props} */';
4629
+ this.$props.comment = '/** @type {$$ComponentProps} */';
4630
4630
  if (props.length > 0 || withUnknown) {
4631
- preprendStr(this.str, node.pos + this.astOffset, `/** @typedef {${propsStr}} $$_sveltets_Props */${this.$props.comment}`);
4631
+ preprendStr(this.str, node.pos + this.astOffset, `/** @typedef {${propsStr}} $$ComponentProps */${this.$props.comment}`);
4632
4632
  }
4633
4633
  }
4634
4634
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte2tsx",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "Convert Svelte components to TSX for type checking",
5
5
  "author": "David Pershouse",
6
6
  "license": "MIT",