Skip to content

Commit a14436a

Browse files
committed
Ejemplo de módulos ESM en Typescript
1 parent 4049896 commit a14436a

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

2023-03-21/javascript-modules-esm/circle.js

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
export const area = (r: number) => Math.PI * r * r;
3+
export const circumference = (r: number) => 2 * Math.PI * r;
4+
5+
export default function () {
6+
return "Este es el círculo.... ;)";
7+
};

2023-03-21/javascript-modules-esm/main.js

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import blisblas, * as circle from "./circle.js";
2+
import type { Rect } from './square';
3+
4+
let r : Rect = { h: 5.0, w: 4.0 };
5+
let r2 : Rect = { h: 0.0, w: 0.0 };
6+
7+
console.log(circle.area(5.0));
8+
console.log(blisblas());
9+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
export type Rect = {
3+
h: number;
4+
w: number;
5+
}
6+
7+
export const area = (rect: Rect) => rect.h * rect.w;

0 commit comments

Comments
 (0)