diff --git a/packages/documentation/copy/en/handbook-v1/Basic Types.md b/packages/documentation/copy/en/handbook-v1/Basic Types.md index d2cf4fd66cba..34124897ff8f 100644 --- a/packages/documentation/copy/en/handbook-v1/Basic Types.md +++ b/packages/documentation/copy/en/handbook-v1/Basic Types.md @@ -16,7 +16,7 @@ The most basic datatype is the simple true/false value, which JavaScript and Typ let isDone: boolean = false; ``` -## Number +## Number As in JavaScript, all numbers in TypeScript are either floating point values or BigIntegers. These floating point numbers get the type `number`, while BigIntegers get the type `bigint`. @@ -383,7 +383,6 @@ You may have noticed that so far, we've been using the `let` keyword instead of The `let` keyword is actually a newer JavaScript construct that TypeScript makes available. You can read in the Handbook Reference on [Variable Declarations](/docs/handbook/variable-declarations.html) more about how `let` and `const` fix a lot of the problems with var. - ## About `Number`, `String`, `Boolean`, `Symbol` and `Object` It can be tempting to think that the types `Number`, `String`, `Boolean`, `Symbol`, or `Object` are the same as the lowercase versions recommended above. @@ -391,19 +390,19 @@ These types do not refer to the language primitives however, and almost never sh ```ts twoslash // @errors: 2339 -function reverse(s: String): String { - return s.split("").reverse().join("") +function reverse(s: String): String { + return s.split("").reverse().join(""); } -reverse("hello world") +reverse("hello world"); ``` Instead, use the types `number`, `string`, `boolean`, `object` and `symbol`. ```ts twoslash -function reverse(s: string): string { - return s.split("").reverse().join("") +function reverse(s: string): string { + return s.split("").reverse().join(""); } -reverse("hello world") +reverse("hello world"); ``` diff --git a/packages/typescriptlang-org/src/components/index/MigrationStories.tsx b/packages/typescriptlang-org/src/components/index/MigrationStories.tsx index 53c8c6503b7b..605d67fab5e2 100644 --- a/packages/typescriptlang-org/src/components/index/MigrationStories.tsx +++ b/packages/typescriptlang-org/src/components/index/MigrationStories.tsx @@ -6,7 +6,7 @@ import { useIntl } from "react-intl" const ReverseRow = (props: { children: any }) =>
{props.children}
-const Slack = ({ firstRun }: { firstRun?: boolean }) => ( +const Slack = () => (
@@ -29,7 +29,7 @@ const Slack = ({ firstRun }: { firstRun?: boolean }) => (
-
+
@@ -80,7 +80,7 @@ const AirBnB = () => (
-
+
@@ -123,7 +123,7 @@ const Google = () => (
-
+
@@ -282,8 +282,6 @@ export const OSS = () => ( ) -let firstRun = true - export const MigrationStories = () => { const i = createInternational(useIntl()) @@ -318,14 +316,6 @@ export const MigrationStories = () => { const titleHeading = document.getElementById("migration_title")! as HTMLHeadingElement titleHeading.textContent = title - - setTimeout(() => { - const copy = document.querySelector("#index .copy")! as HTMLDivElement - if (copy) { - copy.style.opacity = "1" - } - - }, 100) } const prev = (e) => { @@ -359,7 +349,7 @@ export const MigrationStories = () => {
{{ 0: ( - + ), 1: ( @@ -371,7 +361,6 @@ export const MigrationStories = () => { ) }[index]} - {firstRun = false}
) diff --git a/packages/typescriptlang-org/src/components/index/twoslash/generated/cfa.tsx b/packages/typescriptlang-org/src/components/index/twoslash/generated/cfa.tsx index f77cb2cb778e..2d79506efb07 100644 --- a/packages/typescriptlang-org/src/components/index/twoslash/generated/cfa.tsx +++ b/packages/typescriptlang-org/src/components/index/twoslash/generated/cfa.tsx @@ -9,6 +9,6 @@ const innerHTML = `
tsx
console.log(jon) } else { throw new Error('Could not find user "Jon"') -}
` +}Try
` export const CfaExample = () =>
diff --git a/packages/typescriptlang-org/src/components/index/twoslash/generated/interface.tsx b/packages/typescriptlang-org/src/components/index/twoslash/generated/interface.tsx
index c45a6d12d94e..d30f82bc6462 100644
--- a/packages/typescriptlang-org/src/components/index/twoslash/generated/interface.tsx
+++ b/packages/typescriptlang-org/src/components/index/twoslash/generated/interface.tsx
@@ -11,7 +11,7 @@ const innerHTML = `
tsx
function updateUser(id: number, update: Partial<User>) { const user = getUser(id) const newUser = {...user, ...update} - saveUser(id, user) -}
` + saveUser(id, newUser) +}Try` export const InterfaceExample = () =>
diff --git a/packages/typescriptlang-org/src/components/index/twoslash/generated/react.tsx b/packages/typescriptlang-org/src/components/index/twoslash/generated/react.tsx
index bac2fe62dc5f..48a5e535ccf3 100644
--- a/packages/typescriptlang-org/src/components/index/twoslash/generated/react.tsx
+++ b/packages/typescriptlang-org/src/components/index/twoslash/generated/react.tsx
@@ -12,6 +12,6 @@ const innerHTML = `
tsx
export const UserThumbnail = (props: UserThumbnailProps) => <a href={props.url}> <img src={props.img} alt={props.alt} /> - </a>
` + </a>Try` export const ReactExample = () =>
diff --git a/packages/typescriptlang-org/src/components/index/twoslash/generated/showErrors.tsx b/packages/typescriptlang-org/src/components/index/twoslash/generated/showErrors.tsx
index 82edc535884d..009622ff8fd6 100644
--- a/packages/typescriptlang-org/src/components/index/twoslash/generated/showErrors.tsx
+++ b/packages/typescriptlang-org/src/components/index/twoslash/generated/showErrors.tsx
@@ -8,6 +8,6 @@ const innerHTML = `
tsx
} console.log(user.name) -Property 'name' does not exist on type '{ firstName: string; lastName: string; role: string; }'.2339Property 'name' does not exist on type '{ firstName: string; lastName: string; role: string; }'.
` +Property 'name' does not exist on type '{ firstName: string; lastName: string; role: string; }'.2339Property 'name' does not exist on type '{ firstName: string; lastName: string; role: string; }'.Try` export const ShowErrorsExample = () =>
diff --git a/packages/typescriptlang-org/src/components/index/twoslash/generated/typeDefinitions.tsx b/packages/typescriptlang-org/src/components/index/twoslash/generated/typeDefinitions.tsx
index 21b75d13af89..0c88b0dd7b5c 100644
--- a/packages/typescriptlang-org/src/components/index/twoslash/generated/typeDefinitions.tsx
+++ b/packages/typescriptlang-org/src/components/index/twoslash/generated/typeDefinitions.tsx
@@ -9,6 +9,6 @@ const innerHTML = `
tsx
}) -app.listen(3000)
` +app.listen(3000)Try` export const TypeDefinitionsExample = () =>
diff --git a/packages/typescriptlang-org/src/components/index/twoslash/interface.ts-sample b/packages/typescriptlang-org/src/components/index/twoslash/interface.ts-sample
index 36a85d3b021f..e801f0ac75b5 100644
--- a/packages/typescriptlang-org/src/components/index/twoslash/interface.ts-sample
+++ b/packages/typescriptlang-org/src/components/index/twoslash/interface.ts-sample
@@ -13,5 +13,5 @@ interface User {
 function updateUser(id: number, update: Partial) {
   const user = getUser(id)
   const newUser = {...user, ...update}  
-  saveUser(id, user)
+  saveUser(id, newUser)
 }
diff --git a/packages/typescriptlang-org/src/components/layout/LanguageRecommendation.tsx b/packages/typescriptlang-org/src/components/layout/LanguageRecommendation.tsx
index 8f73bf62ad09..024242fd1a65 100644
--- a/packages/typescriptlang-org/src/components/layout/LanguageRecommendation.tsx
+++ b/packages/typescriptlang-org/src/components/layout/LanguageRecommendation.tsx
@@ -59,7 +59,7 @@ export const LanguageRecommendations = (props: Props) => {
     if (localePath === "") localePath = "/"
     if (localePath === location.pathname) return
 
-    const doesPageExist = props.allSitePage.nodes.find(f => f.path === localePath)
+    const doesPageExist = props.allSitePage.nodes.find(f => f.path === localePath || f.path + "/" === localePath)
     if (!doesPageExist) return
 
     //@ts-ignore
@@ -73,6 +73,7 @@ export const LanguageRecommendations = (props: Props) => {
 
     quickJumpA.textContent = lang.shorthand
     quickJumpA.href = localePath
+    quickJump.title = lang.body
     quickJump.style.display = "inline-block";
 
     // Adding the LI somehow makes the search bump up by 2px
diff --git a/packages/typescriptlang-org/src/components/layout/SiteFooter.scss b/packages/typescriptlang-org/src/components/layout/SiteFooter.scss
index 256ff0ba0778..7c8185d5d344 100644
--- a/packages/typescriptlang-org/src/components/layout/SiteFooter.scss
+++ b/packages/typescriptlang-org/src/components/layout/SiteFooter.scss
@@ -68,7 +68,9 @@
   }
 
   section#switcher {
-    border-top: 1px solid rgba(255, 255, 255, 0.3);
+    padding-top: 2px;
+    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
+
     article {
       h3 {
         width: 240px;
@@ -204,6 +206,11 @@
   #playground-samples-popover {
     display: none;
   }
+
+  #community-links ul,
+  #using-typescript ul {
+    margin-left: 12px;
+  }
 }
 
 // This is the li which the popover lives within
diff --git a/packages/typescriptlang-org/src/components/layout/SiteFooter.tsx b/packages/typescriptlang-org/src/components/layout/SiteFooter.tsx
index f4acaf4717c3..abdadc2c47e0 100644
--- a/packages/typescriptlang-org/src/components/layout/SiteFooter.tsx
+++ b/packages/typescriptlang-org/src/components/layout/SiteFooter.tsx
@@ -230,28 +230,19 @@ export const SiteFooter = (props: Props) => {
 
   useEffect(() => {
     if (isDarkMode) {
+      document.documentElement.classList.remove("light-theme")
       document.documentElement.classList.add("dark-theme")
       hasLocalStorage && localStorage.setItem("color-theme", "dark-theme")
 
     } else {
       document.documentElement.classList.remove("dark-theme")
+      document.documentElement.classList.add("light-theme")
       hasLocalStorage && localStorage.setItem("color-theme", "light-theme")
     }
   }, [isDarkMode])
 
   return (