This course has been updated! We now recommend you take the TypeScript Fundamentals, v3 course.

Check out a free preview of the full TypeScript 3 Fundamentals, v2 course:
The "Compiling in "loose mode"" Lesson is part of the full, TypeScript 3 Fundamentals, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Mike describes the first step in converting JavaScript to TypeScript.

Get Unlimited Access Now

Transcript from the "Compiling in "loose mode"" Lesson

>> Mike North: Surf one, you want to compile your project in loose mode. And you begin by making sure your tests pass. And then, rename all your files or a chunk of your files from JavaScript to TypeScript, allowing for implicit any types. Implicit anys pop up whenever the TypeScript compiler cannot infer a more specific and useful type.

[00:00:26] Good example of this would be a function argument. So the way TypeScript infers things is kinda only in one direction. It's, only through receiving a value of some sort, and like passing that on. So, just to highlight this example here.
>> Mike North: This is an implicit any and even if down here, if I try to split it to try to give the clue that it might be a string, it still remains an implicit any.

[00:01:02] Because type information does not, the inference does not flow up from the point of usage to the argument. Some languages do that, this one does not. So functional arguments are placed where you're almost always gonna get an implicit any. The only case where you wouldn't is if it's a call back, and there's a specific type for that call back, and remember, we don't have to specify anything there.

[00:01:26] Your goal in this pass is to fix anything that is causing TypeScript compile errors. Examples of where this will pop up all the time is JavaScript classes. When you change to TypeScript, you're gonna have to go and state the fields and their types, so you know ahead of time what's a valid field and what's not.

[00:01:50] So you're gonna fix that kind of thing, being very careful to avoid changing any behavior, and that is one pull request. Make sure your tests have passed again, and merge that in.