Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript support #59

Open
awinogradov opened this issue Dec 26, 2017 · 4 comments
Open

TypeScript support #59

awinogradov opened this issue Dec 26, 2017 · 4 comments

Comments

@awinogradov
Copy link
Member

Now it works only by this way:

import * as Search from 'b:Search';

console.log(Search);

Because we transpile it to:

const Search = ((
(__webpack_require__(2).default || __webpack_require__(2)).applyDecls()
));

// ts use it like this
console.log(Search);

But! If we want use default export only:

import Search from 'b:Search';

console.log(Search);
const Search = ((
(__webpack_require__(2).default || __webpack_require__(2)).applyDecls()
));

// ts use it like this
console.log(Search.default); // .default -> undefined

We need to transpile it like this:

const Search = {
  default: ((
    (__webpack_require__(2).default || __webpack_require__(2)).applyDecls()
  ))
};
@qfox
Copy link
Member

qfox commented Dec 28, 2017

Lisp (no):

const Search = {
  default: ((
    ( (x=>(x.default||x))(__webpack_require__(2)) ).applyDecls()
  ))
};

@veged veged changed the title TS support TypeScript support Dec 28, 2017
@veged
Copy link
Member

veged commented Dec 28, 2017

@zxqfox
what?

@Yeti-or
Copy link
Member

Yeti-or commented Dec 29, 2017

we don't work with import we work with require

@qfox
Copy link
Member

qfox commented Dec 30, 2017

IT DOES WORK!!!

Guys, why not to use:

declare module 'b:button m:type:radio' {
  etc.
}

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

No branches or pull requests

4 participants