FREE TUTORIALS · Learn from zero to expertBusiness DirectoryPut Your Business Ad Here — Free
Independent course disclaimer · expand / collapse

These are independently developed tutorials. Technology names belong to their respective owners; no endorsement is implied. Examples are educational, not guarantees. Verify commands, costs, security, browser support, and framework versions before production use. Google Translate requires internet and can make mistakes. Terms · Privacy · Legal.

Fundamentals → Mastery guide · Six levels, practical projects, topic checklist, worked code and results.
Level 3 of 6 · Chapter 050 of 145

Type-Only Imports and Exports

Let’s learn this together, starting with what the words mean. We’ll read a little, change actual code or a design, and see the result. You can also narrate the lesson on YouTube.

Beginner-friendly wordingVisible output20 answered questionsVertical code layout
  1. 1. Understand the idea
  2. 2. Read and edit the code
  3. 3. See the output
  4. 4. Practice and explain

Chapter opening: what we are doing

Imagine you want to build a small piece of a real website. Today the useful skill is Type-Only Imports and Exports. You do not need to memorize the entire language before trying it. Start with a working example, watch the result, and then make one small change that you can explain.

Keep the source (the instructions you write) separate from the output (what the browser actually displays). When a feature depends on a real framework application or a design tool, use the original project instructions to run the actual technology. This page also includes an isolated visual demonstration for learning and recording.

Technical words, explained simply

TypeScript (JavaScript with static type checking)
type (a description of the kinds of values allowed)
compiler (a tool that checks and converts source code)
interface (a contract describing an object shape)
inference (when TypeScript figures out a type automatically)

See the code and its output

First read a short piece. Then use Run / Refresh Output. The display below is a real browser frame, not a sentence describing the result.

Step 1 · TypeScript source
Step 2 · Executed code output

Real output: JavaScript compiled from the TypeScript editor runs in an isolated iframe. Edited code is recompiled when you click Run / Refresh Output. Browser compilation does not replace full type-checking with tsc.

Learn it like a book: practical subchapters

Read the ideas in order, then return to the example above. Use your own words: a new learner should understand what each line changes and why the output is different.

050.01 · Goal and completed feature

The practical outcome of Type-Only Imports and Exports is the value printed by this chapter’s own TypeScript example. Start with the .ts file rather than copying a console screenshot.

Try it yourself: Find the part of the sample related to goal and completed feature. Change one label, value, or setting that makes sense for this topic. Run the code again, compare the visible result, and explain the difference as though you were helping a friend start from zero.

050.02 · Inspect the exact TypeScript syntax

Locate this declaration or operation in the example: type Product={sku:string;stock:number}; . Identify which information exists only at compile time and which values remain at runtime.

Try it yourself: Find the part of the sample related to inspect the exact typescript syntax. Change one label, value, or setting that makes sense for this topic. Run the code again, compare the visible result, and explain the difference as though you were helping a friend start from zero.

050.03 · Run the compiled program

Click Run browser demo . The browser executes JavaScript transpiled from the TypeScript example. The first actual output line is ETG-10: 7 in stock .

Try it yourself: Find the part of the sample related to run the compiled program. Change one label, value, or setting that makes sense for this topic. Run the code again, compare the visible result, and explain the difference as though you were helping a friend start from zero.

050.04 · Understand the input → output path

Follow the declared values into the functions, expressions, and final console.log statement. Predict the printed value before opening the browser output panel.

Try it yourself: Find the part of the sample related to understand the input → output path. Change one label, value, or setting that makes sense for this topic. Run the code again, compare the visible result, and explain the difference as though you were helping a friend start from zero.

050.05 · Make a change and verify

Modify the input in the TypeScript source, recompile and check how the type system responds before running.

Try it yourself: Find the part of the sample related to make a change and verify. Change one label, value, or setting that makes sense for this topic. Run the code again, compare the visible result, and explain the difference as though you were helping a friend start from zero.

050.06 · Independent practical challenge

Create a new example.ts using type-only imports and exports for a realistic school, inventory, booking, or course-library feature. Add an explicit type and print both a normal case and an edge case.

Try it yourself: Find the part of the sample related to independent practical challenge. Change one label, value, or setting that makes sense for this topic. Run the code again, compare the visible result, and explain the difference as though you were helping a friend start from zero.

Ready-to-narrate YouTube lesson

Scene 1 · Welcome: “Today we’ll work through Type-Only Imports and Exports. We’re going to start simply, so you can follow even if this is new.”

Scene 2 · Explain: Introduce a technical word from the glossary, and explain what it means with one familiar comparison.

Scene 3 · Show the source: Point out the relevant code line, the file it belongs in, and what you predict it will do.

Scene 4 · Show the result: Run the example, keep the output visible, and describe precisely what changed on the page.

Scene 5 · Improve it: Change one value or style, rerun, then show a common error and how to correct it.

Scene 6 · Finish: Give the viewer a one-minute challenge and direct them to the answered questions.

Use the YouTube Recording View button in the toolbar for a simplified reading screen. This is a narration outline, not a recorded audio/video file.

Practice: make it yours

  1. Run the starting example and confirm the output.
  2. Explain Type-Only Imports and Exports in simple language without reading the page word for word.
  3. Change one meaningful input, style, label, event, or component detail.
  4. Show the before and after output; do not substitute a description for the result.
  5. Make a tiny usable feature using the same idea. Check on a narrow phone screen and using a keyboard.
  6. Write down one mistake, the error message you saw, and the fix that worked.

Final challenge: Teach this chapter to someone who has never used TypeScript. Start with what the code is for, then demonstrate the code and output in order.

20 practice questions and answered explanations

Say the answer aloud first, then open the explanation. Every answer is included so you can check your understanding independently.

Q01. In your own words, what should you know about goal and completed feature?

Answer: The practical outcome of Type-Only Imports and Exports is the value printed by this chapter’s own TypeScript example. Start with the .ts file rather than copying a console screenshot.

Q02. In your own words, what should you know about inspect the exact typescript syntax?

Answer: Locate this declaration or operation in the example: type Product={sku:string;stock:number}; . Identify which information exists only at compile time and which values remain at runtime.

Q03. In your own words, what should you know about run the compiled program?

Answer: Click Run browser demo . The browser executes JavaScript transpiled from the TypeScript example. The first actual output line is ETG-10: 7 in stock .

Q04. In your own words, what should you know about understand the input → output path?

Answer: Follow the declared values into the functions, expressions, and final console.log statement. Predict the printed value before opening the browser output panel.

Q05. In your own words, what should you know about make a change and verify?

Answer: Modify the input in the TypeScript source, recompile and check how the type system responds before running.

Q06. In your own words, what should you know about independent practical challenge?

Answer: Create a new example.ts using type-only imports and exports for a realistic school, inventory, booking, or course-library feature. Add an explicit type and print both a normal case and an edge case.

Q07. What is the goal of “Type-Only Imports and Exports”?

Answer: Use the chapter example to understand type-only imports and exports and prove the result with visible browser output.

Q08. Which course introduces this skill?

Answer: TypeScript. This is chapter 50 of 145, in level 3.

Q09. What should I do before changing the example?

Answer: Run the original example first. Notice its visible result and any console messages so you have a baseline for comparison.

Q10. Where is the example source?

Answer: Look in the editable source panel, copy it, and place it in the appropriate project file. The exact file depends on the lesson; for common starter exercises it may be the chapter source file.

Q11. What proves the example really worked?

Answer: The Output panel must show a rendered result or actual console text. Text describing an expected result is not proof by itself.

Q12. Why should I change one thing at a time?

Answer: One edit at a time lets you connect the code change with the output difference. If you change many things, finding the cause becomes much harder.

Q13. How should I investigate an error in this chapter?

Answer: Read the first useful error in the browser console or build tool; check spelling, file paths, imports, tags, braces and brackets before guessing.

Q14. How can I explain “Type-Only Imports and Exports” in a video?

Answer: Show the working starting point, point at the exact relevant line, change it, rerun, and describe what the viewer can see. Avoid reading all code aloud.

Q15. What is the smallest practice project for this chapter?

Answer: Rebuild the demonstration without copying every line. Keep the original open only for checking specific syntax or debugging.

Q16. What needs checking on a narrow phone screen?

Answer: Check that there is no page-wide sideways scroll, text wraps, controls remain reachable, and the preview works at a small width.

Q17. How can I test keyboard accessibility?

Answer: Use Tab, Shift+Tab, Enter and Space to reach and activate interactive elements. Keep focus visible and labels meaningful.

Q18. When is a framework development server necessary?

Answer: When the original sample depends on compilation, bundling, modules, JSX, templates, framework runtime or server features. The isolated browser preview is not that runtime.

Q19. What should I save after finishing?

Answer: Keep the source files, the observed result, one error you corrected, and a brief note about the skill you demonstrated.

Q20. What does successful independent practice look like?

Answer: You can explain the purpose, write a basic working version, show the output, and fix a small mistake without being led through every step.

Disclaimer, trademarks and learning guidance

Independent educational material. External names are used solely to identify subjects. These tutorials are not official training or certification. Output may vary by browser and software version. If a framework requires a build tool, the standalone browser demonstration is an illustration, not execution of the framework source. Always test your own code before publication. Legal notice.