Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

Weird transpile of function with returning interface #616

Open
ivaxi opened this issue Nov 13, 2018 · 0 comments
Open

Weird transpile of function with returning interface #616

ivaxi opened this issue Nov 13, 2018 · 0 comments

Comments

@ivaxi
Copy link

ivaxi commented Nov 13, 2018

Bug Report

Current Behavior

exported function in DictionaryFormHelpers.ts :

export function getEmptyStateChange(): IDictionaryFormState { console.log('strange things'); return {} as IDictionaryFormState; };
transpile in to:
function Wl() { return console.log("strange things"), {} }
Result is little strange but worked. Then i change function declaration to:

export function getEmptyStateChange(): IDictionaryFormState { return {} as IDictionaryFormState; };

its become simply in caller scope:
var a = { dataLoading: !0 }

thats wrong - dataLoading field cant be 'true' (!0) - its not initilazed by any value.

Intrface declaration:
export interface IDictionaryFormState { loadData?: boolean; dataLoading?: boolean; }

function call in parent scope:

const stateChange:IDictionaryFormState = DictionaryFormHelpers.getEmptyStateChange();

Expected behavior/code
Im expected that code
export function getEmptyStateChange(): IDictionaryFormState { return {} as IDictionaryFormState; };
trianspile in to:

function Wl() { return {} }

I know that this function is dumb output, but it required for type checking in ts.
Is it problem with atl?

Environment
"babel-loader": "8.0.4",
"awesome-typescript-loader": "5.2.1",
"@babel/core": "7.1.2",

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant