import type { SomeThing } from "./some-module.js"
export type { SomeThing }import type { Component } from "react"
interface ButtonProps {
// ...
}
class Button extends Component<ButtonProps> {
// ~~~~~~~~~
// error! 'Component' only refers to a type,
// but is being used as a value here.
}class Person {
#name: string
constructor(name: string) {
this.#name = name;
}
greet() {
console.log(`Hello, my name is ${this.#name}!`);
}
}
let jeremy = new Person("Jeremy Bearimy");
jeremy.#name
// ~~~~~
// Property '#name' is not accessible outside class 'Person'
// because it has a private identifier.import * as utilities from "./utilities.js"
export { utilities }export * as utilities from "./utilities.js"
const response = await fetch("...");
const greeting = await response.text();
export { response, greeting };// @ts-check
class Foo {
constructor() {
/** @private */
this.stuff = 100;
}
printStuff() {
console.log(this.stuff);
}
}
new Foo().stuff;
// ~~~~~
// error! Property 'stuff' is private
// and only accessible within class 'Foo'.
new Foo().stuff++;
// ~~~~~
// Cannot assign to 'stuff' because it is
// a read-only property.--assumeChangesOnlyAffectDirectDependencies
Visual Studio code base recompile time 14s - 1s