Skip to content

getDeclarationOfAliasSymbol assert with shortid npm module in 2@next #10460

Closed
@seanmiddleditch

Description

@seanmiddleditch

TypeScript Version: 2.1.0 / nightly (2.1.0-dev.20160821)

Error Message

G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:37610                                                            
                throw e;                                                                                                            
                ^                                                                                                                   

Error: Debug Failure. False expression:                                                                                             
    at Object.assert (G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:1289:23)                                   
    at Object.fail (G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:1294:19)                                     
    at Object.findMap (G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:211:15)                                   
    at getDeclarationOfAliasSymbol (G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:13927:23)                    
    at checkExternalModuleExports (G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:26428:39)                     
    at checkSourceFileWorker (G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:26635:21)                          
    at checkSourceFile (G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:26610:13)                                
    at Object.forEach (G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:185:30)                                   
    at getDiagnosticsWorker (G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:26659:16)                           
    at getDiagnostics (G:\Sean\Documents\Projects\test\node_modules\typescript\lib\tsc.js:26647:24)                                 

package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "typings": "typings",
    "tsc": "tsc"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "shortid": "^2.2.6",
    "typescript": "^2.1.0-dev.20160821",
    "typings": "^1.3.2"
  }
}

tsconfig.json

{
    "compileOnSave": true,
    "compilerOptions": {
        "module": "commonjs",
        "moduleResolution": "node",
        "target": "es6",
        "noImplicitAny": true,
        "strictNullChecks": true,
        "sourceMap": true,
        "allowJs": true,
        "outDir": "bin"
    },
    "files": ["index.ts"]
}

typings.json

{
  "globalDependencies": {
    "shortid": "registry:dt/shortid#0.0.0+20160316155526"
  }
}

index.ts

import * as shortid from 'shortid';

Reproduction Steps

npm install
npm run typings -- install
npm run tsc

Note

Removing the Object.fail in Object.findMap results in a crash-free compilation with no ill-effects that I can observe, including on a somewhat larger project.

shortid is not the only module that causes this. I've also observed debug causing this. I'm not sure how many others my app might be hitting since I can't see latter failures until somehow avoiding former ones.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions