ripple 0.2.66 → 0.2.67

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ripple is an elegant TypeScript UI framework",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.2.66",
6
+ "version": "0.2.67",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index.js",
9
9
  "main": "src/runtime/index.js",
@@ -324,6 +324,13 @@ const visitors = {
324
324
  }
325
325
  },
326
326
 
327
+ PropertyDefinition(node, context) {
328
+ if (!context.state.to_ts) {
329
+ delete node.typeAnnotation;
330
+ }
331
+ return context.next();
332
+ },
333
+
327
334
  VariableDeclaration(node, context) {
328
335
  const declarations = [];
329
336
 
@@ -1152,7 +1159,9 @@ const visitors = {
1152
1159
  },
1153
1160
 
1154
1161
  TemplateLiteral(node, context) {
1155
- if (node.expressions.length === 0) {
1162
+ const parent = context.path.at(-1);
1163
+
1164
+ if (node.expressions.length === 0 && parent?.type !== 'TaggedTemplateExpression') {
1156
1165
  return b.literal(node.quasis[0].value.cooked);
1157
1166
  }
1158
1167
 
@@ -1474,6 +1483,7 @@ function transform_children(children, context) {
1474
1483
  node.type === 'DebuggerStatement' ||
1475
1484
  node.type === 'ClassDeclaration' ||
1476
1485
  node.type === 'TSTypeAliasDeclaration' ||
1486
+ node.type === 'TSInterfaceDeclaration' ||
1477
1487
  node.type === 'Component'
1478
1488
  ) {
1479
1489
  const metadata = { await: false };
@@ -65,7 +65,7 @@ describe('compiler success tests', () => {
65
65
  });
66
66
 
67
67
 
68
- /*it('renders without crashing using < character', () => {
68
+ it('renders without crashing using < character', () => {
69
69
  component App() {
70
70
  function bar() {
71
71
  for (let i = 0; i < 10; i++) {
@@ -80,7 +80,7 @@ describe('compiler success tests', () => {
80
80
  }
81
81
 
82
82
  render(App);
83
- });*/
83
+ });
84
84
 
85
85
  it('render lexical blocks without crashing', () => {
86
86
  component App() {
@@ -240,4 +240,44 @@ describe('compiler success tests', () => {
240
240
 
241
241
  render(App);
242
242
  });
243
+
244
+ it('should not fail with random TS syntax', () => {
245
+ function tagFn() {
246
+ return null;
247
+ }
248
+
249
+ function Wrapper() {
250
+ return {
251
+ unwrap: function<T>() {
252
+ return null as unknown as T;
253
+ }
254
+ }
255
+ }
256
+
257
+ component App() {
258
+ let x: number[] = [] as number[];
259
+
260
+ const n = new Wrapper<number>().unwrap<string>();
261
+
262
+ const tagResult = tagFn`value`;
263
+
264
+ interface Node<T> {
265
+ value: T;
266
+ }
267
+
268
+ class Box<T> {
269
+ value: T;
270
+
271
+ method<T>(): T {
272
+ return this.value;
273
+ }
274
+ }
275
+
276
+ let flag = true;
277
+
278
+ const s = flag ? new Box<number>() : new Box<string>();
279
+ }
280
+
281
+ render(App);
282
+ });
243
283
  });