src/compiler/parser.ts exports function with return type of private interface #1112

wants to merge 2 commits into


None yet

4 participants

chbrown commented Nov 10, 2014

Export ReferencePathMatchResult interface to fix 'error TS4060: Return type of exported function has or is using private name' when generating declarations from src/compiler/*.ts.

See #1111

Tests run just fine.

29974 passing (2m)

chbrown commented Nov 10, 2014

I meant that second fix to be a separate PR, but it's just another one-liner in the same file, so maybe you can grab them at the same time?



@mhegazy mhegazy commented on the diff Nov 10, 2014
@@ -1,6 +1,7 @@
/// <reference path="types.ts"/>
/// <reference path="core.ts"/>
/// <reference path="scanner.ts"/>
+/// <reference path="checker.ts"/>
mhegazy Nov 10, 2014 Contributor

The parser should not include the checker. it is the other way around. think of them as layers. the type system is a higher layer than syntax.

if there is a dependency the right thing is to move the dependency to types.ts

CyrusNajmabadi Nov 10, 2014 Contributor

or to 'core.ts'.

chbrown Nov 10, 2014

That makes sense structurally, but parser.ts explicitly calls the function createTypeChecker on line 4298, which is defined in checker.ts (line 64). The reason why it compiles successfully in the jake local call is because checker.ts is explicitly included in the tsc command line arguments.

You can see the issue by running:

node bin/tsc --out tmp.js src/compiler/parser.ts

src/compiler/parser.ts(4298,50): error TS2304: Cannot find name 'createTypeChecker'.

mhegazy commented Nov 10, 2014

i you want the declaration, just run:

jake declaration local

This will generate a tsc.d.ts and typescriptservices.d.ts emitted in the built\local directory, obviously you still need the export you identified.

mhegazy commented Nov 17, 2014

The interface should be exported now.

@mhegazy mhegazy closed this Nov 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment