×

LingQ'yu daha iyi hale getirmek için çerezleri kullanıyoruz. Siteyi ziyaret ederek, bunu kabul edersiniz: çerez politikası.

image

Programming, TypeScript in 100 Seconds

TypeScript in 100 Seconds

[Music]

typescript validate your javascript

ahead of time with static type checking

javascript is a dynamic language where

we can do all kinds of crazy things

like reference variables that don't

exist or work with objects of an unknown

shape the code is interpreted by a

browser

but if your code is broken you won't

catch it until runtime when the browser

rows an error

typescript prevents errors like this

from ever happening by extending

javascript with types

the language is a strict superset of

javascript which means when you open up

a ts file you can write plain javascript

with all of its extra features

being completely optional but notice in

the code here how the ide

is providing feedback about using a

variable that doesn't exist

instead of fixing this issue weeks later

in a stack trace after the company has

lost millions of dollars we can fix it

right here right now

the reason we get this instant feedback

is because typescript behaves like a

compiled language

where javascript is the compilation

target you can run the typescript

compiler

using the tsc command it will take the

ts file and transpile it into vanilla

javascript

and you can choose any flavor of

javascript you want if you need to

target ancient browsers

and that means you can use the latest

and greatest syntax features of

javascript without having to worry if

they'll be supported in an older

environment your typescript project will

likely have a ts config file

which provides an infinite number of

ways to customize the behavior of the

compiler

but the primary goal of typescript is to

enable static typing

one way it achieves that is by allowing

you to annotate your code with types

we can strongly type a variable using a

colon followed by its type like a string

boolean or number

that's known as an explicit type if we

then try to assign its value as the

wrong type we get an error

alternatively if we set an initial value

it will implicitly infer the type

however there may be cases where you

want to opt out of this behavior

in which case you can annotate with the

any type that allows you to loosely type

or opt out of type checking when working

with an array

use brackets to strongly type a list in

addition you can define your own custom

types and interfaces

which is especially powerful when

working with objects the car interface

here defines various types

of the properties on an object we can

then apply the interface to a plain

javascript object

the beauty of having strongly typed code

is that we get autocomplete everywhere

in our ide

we don't have to jump back and forth to

documentation or dig through stack

traces to figure out why our code's not

working

if you like typescript as much as i do

consider becoming a pro member at

fireship io for the next few days

everything will be 40 off including

lifetime memberships thanks for watching

and i will see you in the next one

Learn languages from TV shows, movies, news, articles and more! Try LingQ for FREE

TypeScript in 100 Seconds TypeScript(1)||秒 TypeScript|| TypeScript overview|in|one second TypeScript||Segundos TypeScript en 100 segundos|| TypeScript في 100 ثانية TypeScript in 100 Sekunden TypeScript in 100 Seconds TypeScript en 100 segundos TypeScript en 100 secondes Dattiloscritto in 100 secondi 100秒でわかるTypeScript 100초 만에 배우는 타입스크립트 TypeScript w 100 sekund TypeScript em 100 segundos TypeScript за 100 секунд 100 Saniyede TypeScript 100 秒内完成 TypeScript

[Music] Музыка Música 音乐(1) [Musica] [音乐]

typescript validate your javascript ||你的|JavaScript 代码 |valida||typescript typescript|перевірити||javascript typescript|zweryfikować|twój|javascript |||validar tu javascript المطبوع عليه التحقق من صحة جافا سكريبت الخاص بك dattiloscritto convalida il tuo javascript typescript validar o seu javascript typescript 验证你的 javascript

ahead of time with static type checking ||время|||| ||||||type validation antes||||estático|estático|verificação 提前|||使用|静态|类型|检查 z wyprzedzeniem||||statycznym|typ|sprawdzanie заздалегід|||||тип|перевірка por adelantado||||estática|| في وقت مبكر مع فحص نوع ثابت in anticipo con il controllo del tipo statico заранее с помощью статической проверки типов 提前进行静态类型检查

javascript is a dynamic language where |是|一种|动态|语言|在其中 |||динамічна|мова| |||dinâmica|| ||||язык| جافا سكريبت هي لغة ديناميكية حيث javascript è un linguaggio dinamico in cui

we can do all kinds of crazy things 我们||做|所有|各种|各种|疯狂的|事情 ||||||locas|cosas ||||tipos||loucas| |możemy|||rodzajów||| ||||різні||божевільні| يمكننا القيام بكل أنواع الأشياء المجنونة possiamo fare tutti i tipi di cose pazze 我们可以做各种疯狂的事情

like reference variables that don't |||которые| ||variables|que| |referencja||| |referência|variáveis|| |посилання|змінні||не مثل المتغيرات المرجعية التي لا come le variabili di riferimento che non lo fanno

exist or work with objects of an unknown ||||объекты|||неизвестный ||||objetos|||desconhecida існувати||||||| |||||de||desconocido موجودة أو تعمل مع أشياء مجهولة esistere o lavorare con oggetti di uno sconosciuto

shape the code is interpreted by a ||||executed|| forma|||||| forma||||interpretado|| ||||інтерпретується|| شكل الكود يتم تفسيره بواسطة أ forma il codice è interpretato da a форма кода интерпретируется

browser navegador المتصفح browser

but if your code is broken you won't |||||сломанный|| |||||quebrado|| |||||непрацююч|| pero|||||roto|tú| ولكن إذا تم كسر الكود الخاص بك ، فلن تفعل ذلك ma se il tuo codice è rotto non lo farai

catch it until runtime when the browser |||execução||| captura||hasta|tiempo de ejecución|||navegador قبض عليه حتى وقت التشغيل عندما المتصفح catturalo fino al runtime quando il browser

rows an error linhas(1)||um erro صفوف خطأ righe un errore

typescript prevents errors like this |||como| |previne|erros|| المطبوع عليه يمنع أخطاء مثل هذا dattiloscritto previene errori come questo

from ever happening by extending ||происходить|| ||||prolonging ||acontecendo|| de|nunca|sucediendo||extendiendo من أي وقت مضى عن طريق التوسع dal mai accadere estendendo

javascript with types جافا سكريبت بأنواعها

the language is a strict superset of |||||superset| ||||fully inclusive of|includes entirely| |||||um superconjunto| |||||superconjunto estricto de| اللغة هي مجموعة شاملة صارمة من la lingua è un rigoroso superset di

javascript which means when you open up |que|significa|cuando|tú|abres| جافا سكريبت وهو ما يعني عندما تفتح javascript che significa quando apri

a ts file you can write plain javascript |ts|||||| |um arquivo ts(1)|arquivo||||simples| |archivo ts|||||| ts يمكنك كتابة جافا سكريبت عادي un file ts puoi scrivere javascript semplice

with all of its extra features |||||características con|todas|de|sus|extra| بكل ميزاته الإضافية

being completely optional but notice in ||entirely up to||| |completamente|opcional||observação| ser|||pero||en كونها اختيارية تمامًا ولكن لاحظ ذلك essendo completamente facoltativo ma nota in

the code here how the ide |||||ide |código|aquí|cómo|el|ide رمز هنا كيف بيئة تطوير متكاملة il codice qui come l'ide

is providing feedback about using a |proporcionando|retroalimentación|sobre|| |fornecendo|feedback||| يقدم ملاحظات حول استخدام ملف sta fornendo feedback sull'utilizzo di a

variable that doesn't exist variável||| zmienna||| متغير غير موجود

instead of fixing this issue weeks later ||||problemu|| ||resolver||questão|| en lugar de||arreglando||problema|semanas| بدلاً من إصلاح هذه المشكلة بعد أسابيع invece di risolvere questo problema settimane dopo

in a stack trace after the company has ||call sequence||||| ||uma pilha|rastro|||empresa| ||stogu||||| in una traccia dello stack dopo che l'azienda ha

lost millions of dollars we can fix it ||||||arreglar| |||dólares|||| perso milioni di dollari possiamo aggiustarlo

right here right now aquí|aquí|ahora|ahora proprio qui proprio ora

the reason we get this instant feedback |||||imediato| |||||natychmiastowe| |razón||||| |||||миттєвий| il motivo per cui otteniamo questo feedback immediato

is because typescript behaves like a |||comporta-se|| |||zachowuje|| |porque||comporta|| |||поводиться|| è perché il dattiloscritto si comporta come a

compiled language compiled| skompilowany| компільована| linguaggio compilato

where javascript is the compilation ||||JavaScript processing ||||compilação ||||kompilacija ||||kompilacja ||||компіляція ||||compilación de JavaScript dove javascript è la compilazione

target you can run the typescript puedes||||| typescript||||| typy skryptu||||| target puoi eseguire il dattiloscritto

compiler compilador kompilator Compilador compilatore

using the tsc command it will take the ||tsc||||| ||tsc|comando|||| ||tsc(1)|polecenie|||| ||usando tsc|||||

ts file and transpile it into vanilla |||transpile|||baunilha |||Convert TypeScript||| |||транспілю|||чистий JavaScript |||transpilar|||vainilla pura |||transpiluj|||wanilia ts file e traspilalo in vaniglia

javascript

and you can choose any flavor of |||||any type of| |||||smak| |||escolher||sabor|

javascript you want if you need to

target ancient browsers ||Navegadores antiguos objetivo |outdated| |antigos|navegadores |stare|przeglądarki prendere di mira i browser antichi

and that means you can use the latest |||||||mais recente |||||||najnowszy

and greatest syntax features of |maiores|sintática|| |największe|słowosytuacja||

javascript without having to worry if |sin|tener||preocuparse|

they'll be supported in an older ellos||||| eles||apoiados||| będą||wspierani|||

environment your typescript project will |||projeto| |||projekt| entorno||||

likely have a ts config file ||||configuração| ||||archivo de configuración| prawdopodobnie||||ts config|

which provides an infinite number of |||infinita|número| |zapewnia||nieskończoną|| que|proporciona|un|||de

ways to customize the behavior of the ||modify|||| ||dostosować|||| ||personalizar el comportamiento||comportamiento|| ||personalizar||||

compiler

but the primary goal of typescript is to |||meta|||| ||principal|objetivo||||

enable static typing habilitar|estática|tipado włącza||typowanie

one way it achieves that is by allowing |||alcança||||permitindo |||osiąga||||pozwalając |||logra||||

you to annotate your code with types ||Label|||| ||annotować|||| tú||anotar||código|| ||anotar||||

we can strongly type a variable using a ||fuertemente||||| ||fortemente||||| ||mocno|||||

colon followed by its type like a string colon type string||||||| dwukropek|||||||a Dos puntos|seguido|||||| dois pontos|seguido||||||string

boolean or number booleano|| boolean(1)|| boolean o número||

that's known as an explicit type if we ||||clearly defined type||| ||||jawny|||

then try to assign its value as the |||atribuir||valor|| |||przypisz||||

wrong type we get an error incorrecto|||||

alternatively if we set an initial value alternatywnie|||||początkową| |||||starting| alternativamente si establecemos|||||| alternativamente|||||inicial|

it will implicitly infer the type |||inferir implícitamente|| ||in a way|deduce|| ||implicitamente|inferir|| ||implicitnie|wnioskować||

however there may be cases where you ||||casos|| ||||przypadki|| sin embargo|hay|puede||casos|donde|tú

want to opt out of this behavior ||choose to leave|||| ||optar|||| quiere||||||comportamiento ||zrezygnować||||

in which case you can annotate with the |||||add notes|| |cual||||||

any type that allows you to loosely type ||||||flexibly typed| |||permite|||libremente| |||permite|||livremente|

or opt out of type checking when working

with an array ||um array(1)

use brackets to strongly type a list in |angle brackets|||||| |colchetes (1)|||||| |corchetes||fuertemente||||

addition you can define your own custom ||||||personalizado adição|||definir||sua|personalizada

types and interfaces ||interfaces

which is especially powerful when ||especialmente|poderosa| la cual|||poderosa|

working with objects the car interface

here defines various types |define||

of the properties on an object we can |||||objeto|nosotros| ||as propriedades|||um objeto||

then apply the interface to a plain ||||||superficie simple |||interface|||

javascript object

the beauty of having strongly typed code ||||fuertemente|tipado fuerte| |a beleza||||tipada|

is that we get autocomplete everywhere ||||autocompletar| |||obtenemos|autocompletar|

in our ide |nuestro|

we don't have to jump back and forth to |||||||para trás e para frente|

documentation or dig through stack ||dig|a través de| documentação||||

traces to figure out why our code's not investigates||||||| ||||||del código| rastreia||figura(1)||||código|

working

if you like typescript as much as i do

consider becoming a pro member at |||um|membro|

fireship io for the next few days fireship.io website|||||| navio de fogo|io|||||dias fireship io||||||

everything will be 40 off including

lifetime memberships thanks for watching |membresías de por vida||| vitalícia|associações|||

and i will see you in the next one