Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions packages/documentation/copy/en/handbook-v2/Modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function helloWorld() {
}
// @filename: index.ts
// ---cut---
import helloWorld from "./hello.js";
import helloWorld from "./hello.ts";
helloWorld();
```

Expand Down Expand Up @@ -107,7 +107,7 @@ export function absolute(num: number) {
}
// @filename: app.ts
// ---cut---
import { pi, phi, absolute } from "./maths.js";
import { pi, phi, absolute } from "./maths.ts";

console.log(pi);
const absPhi = absolute(phi);
Expand All @@ -123,7 +123,7 @@ An import can be renamed using a format like `import {old as new}`:
export var pi = 3.14;
// @filename: app.ts
// ---cut---
import { pi as π } from "./maths.js";
import { pi as π } from "./maths.ts";

console.log(π);
// ^?
Expand All @@ -137,7 +137,7 @@ export const pi = 3.14;
export default class RandomNumberGenerator {}

// @filename: app.ts
import RandomNumberGenerator, { pi as π } from "./maths.js";
import RandomNumberGenerator, { pi as π } from "./maths.ts";

RandomNumberGenerator;
// ^?
Expand All @@ -160,7 +160,7 @@ export function absolute(num: number) {
}
// ---cut---
// @filename: app.ts
import * as math from "./maths.js";
import * as math from "./maths.ts";

console.log(math.pi);
const positivePhi = math.absolute(math.phi);
Expand All @@ -174,7 +174,7 @@ You can import a file and _not_ include any variables into your current module v
export var pi = 3.14;
// ---cut---
// @filename: app.ts
import "./maths.js";
import "./maths.ts";

console.log("3.14");
```
Expand All @@ -195,7 +195,7 @@ export interface Dog {
}

// @filename: app.ts
import { Cat, Dog } from "./animal.js";
import { Cat, Dog } from "./animal.ts";
type Animals = Cat | Dog;
```

Expand All @@ -212,12 +212,12 @@ export type Dog = { breeds: string[]; yearOfBirth: number };
export const createCatName = () => "fluffy";

// @filename: valid.ts
import type { Cat, Dog } from "./animal.js";
import type { Cat, Dog } from "./animal.ts";
export type Animals = Cat | Dog;

// @filename: app.ts
// @errors: 1361
import type { createCatName } from "./animal.js";
import type { createCatName } from "./animal.ts";
const name = createCatName();
```

Expand All @@ -232,7 +232,7 @@ export type Dog = { breeds: string[]; yearOfBirth: number };
export const createCatName = () => "fluffy";
// ---cut---
// @filename: app.ts
import { createCatName, type Cat, type Dog } from "./animal.js";
import { createCatName, type Cat, type Dog } from "./animal.ts";

export type Animals = Cat | Dog;
const name = createCatName();
Expand Down Expand Up @@ -360,7 +360,7 @@ For example, here is a TypeScript file using ES Modules syntax, showcasing a few
export const valueOfPi = 3.142;
// @filename: index.ts
// ---cut---
import { valueOfPi } from "./constants.js";
import { valueOfPi } from "./constants.ts";

export const twoPi = valueOfPi * 2;
```
Expand All @@ -371,7 +371,7 @@ export const twoPi = valueOfPi * 2;
// @showEmit
// @module: es2020
// @noErrors
import { valueOfPi } from "./constants.js";
import { valueOfPi } from "./constants.ts";

export const twoPi = valueOfPi * 2;
```
Expand All @@ -382,7 +382,7 @@ export const twoPi = valueOfPi * 2;
// @showEmit
// @module: commonjs
// @noErrors
import { valueOfPi } from "./constants.js";
import { valueOfPi } from "./constants.ts";

export const twoPi = valueOfPi * 2;
```
Expand All @@ -393,7 +393,7 @@ export const twoPi = valueOfPi * 2;
// @showEmit
// @module: umd
// @noErrors
import { valueOfPi } from "./constants.js";
import { valueOfPi } from "./constants.ts";

export const twoPi = valueOfPi * 2;
```
Expand Down