When using THREE.js along with Typescript, you can use the same names for types and code. For example:
import * as THREE from '/build/three.module.js'
// Following line uses THREE.Scene as type and code
const scene: THREE.Scene = new THREE.Scene()
Im trying to replicate the same behaviour in my own code, but In not sure how to do it. This is what Ive tried:
// typedModule.ts
export const typedConstant1: string = "string";
// Doesnt work
// declare global {
// namespace typedModule {
// export type typedConstant1 = typeof typedConstant1
// }
// }
// index.ts
import * as typedModule from "./typedModule";
const someVariable: typedModule.typedConstant1 = typedModule.typedConstant1; // ERROR: Namespace '"/sandbox/src/typedModule"' has no exported member 'typedConstant1'.ts(2694)