Skip to content

Instantly share code, notes, and snippets.

@Bnaya
Created October 21, 2020 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bnaya/f88130a9321b2706e1745f8695ff9664 to your computer and use it in GitHub Desktop.
Save Bnaya/f88130a9321b2706e1745f8695ff9664 to your computer and use it in GitHub Desktop.

Re-export class + intermediate variable = "using private name" error

run yarn tsc4p1 = "using private name" error

run yarn tsc4p0 = "using private name" error

/**
* @param {string} a
*/
function bar(a) {
return a + a;
}
class SomeClass {
a() {
return 1;
}
}
module.exports = {
bar,
SomeClass
}
const { SomeClass } = require('./lib');
const IntermediateClass = SomeClass;
module.exports = {
IntermediateClass,
}
{
"name": "using-private-name-emit-types-from-js-issue-still-an-issue",
"version": "1.0.0",
"author": "Bnaya Peretz",
"license": "MIT",
"private": "true",
"scripts": {
"tsc4p0": "npx -p typescript@4.0.x tsc",
"tsc4p1": "npx -p typescript@4.1.0-dev.20201021 tsc"
},
"devDependencies": {
"typescript": "^4.1.0-dev.20201021"
}
}
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
"allowJs": true,
"checkJs": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./",
"composite": true,
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo",
"isolatedModules": true,
"strict": true,
"types": [],
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["main.js", "lib.js"],
"exclude": ["dist"]
}
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
typescript@^4.1.0-dev.20201021:
version "4.1.0-dev.20201021"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-dev.20201021.tgz#0e12186483bfad5fffd59898c434adc750f3c605"
integrity sha512-AysECaeZgcDxcSDtzFq3hBwJ7cCG7md0gWBZIH19UPDcGtJBaAM6F/NCT4LZ4AV2NeGLQtEAGzE53lMq/i5whw==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment