Created
March 8, 2020 04:24
-
-
Save mastermatt/ab2e06dbae4f44769e4366a03e503147 to your computer and use it in GitHub Desktop.
Reproduce Error: TS2749: 'Thing' refers to a value, but is being used as a type here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generated by tsc | |
export const Thing: typeof import("./thing"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Thing = require('./thing'); | |
module.exports = { Thing }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generated by tsc | |
export = Thing; | |
declare class Thing { | |
/** | |
* @param {string} name | |
*/ | |
constructor(name: string); | |
name: string; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Thing { | |
/** | |
* @param {string} name | |
*/ | |
constructor(name) { | |
this.name = name; | |
} | |
} | |
module.exports = Thing; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"target": "es2018", | |
"esModuleInterop": true, | |
"allowJs": true, | |
"checkJs": false, | |
"declaration": true, | |
"emitDeclarationOnly": true | |
}, | |
"files": [ | |
"index.js" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Thing } from "jsapp"; | |
export const createThing = (): Thing => { // <- Error: TS2749: 'Thing' refers to a value, but is being used as a type here. | |
return new Thing('Bob'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment