diff --git a/packages/documentation/copy/en/handbook-v2/Modules.md b/packages/documentation/copy/en/handbook-v2/Modules.md index d84f9f9e7575..12d44df7a6b8 100644 --- a/packages/documentation/copy/en/handbook-v2/Modules.md +++ b/packages/documentation/copy/en/handbook-v2/Modules.md @@ -73,7 +73,7 @@ export default function helloWorld() { } // @filename: index.ts // ---cut--- -import helloWorld from "./hello.js"; +import helloWorld from "./hello.ts"; helloWorld(); ``` @@ -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); @@ -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(π); // ^? @@ -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; // ^? @@ -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); @@ -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"); ``` @@ -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; ``` @@ -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(); ``` @@ -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(); @@ -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; ``` @@ -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; ``` @@ -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; ``` @@ -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; ```