Skip to content

Can't use list export for interfaces with --declaration #15120

Closed
@Avol-V

Description

@Avol-V

TypeScript Version: 2.2.2

Code

function main( options: Options )
{
	console.log( options );
}

interface Options
{
	option: string;
}

export {
	main as default,
	Options,
};
{
	"compilerOptions": {
		"target": "es2015",
		"declaration": true
	},
	"files": [
		"index.ts"
	]
}

Expected behavior:

It should compile without errors.

Actual behavior:

index.ts(1,25): error TS4078: Parameter 'options' of exported function has or is using private name 'Options'.

But all works with this change:

function main( options: Options )
{
	console.log( options );
}

export interface Options
{
	option: string;
}

export {
	main as default,
};

It's the same code, but TypeScript can't recognise export of the interface in list. I want to see module interface in one place and I prefer to use list export.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions