BrasilAPI / BrasilAPI/cep-promise

Import com Typescript

Open
#212 22 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3k
Forks
317
PR merge metrics
No merged PRs in 30d

Description

Olá pessoal,

Gostaria de uma orientação para realizar o import com Angular 11 (Typescript).
Eu não tinha nenhum problema em alguma versões anteriores do cep-promise (4.0.3).

Porém agora nessas versões recentes está me apresentando um erro na hora realizar o import do cep-promise.

Já tentei das seguintes formas:

```
import cep from 'cep-promise';

cep('09665000')
.then(cep => {
console.log(cep);
});
```

Erro apresentado no console do Navegador:
```
ERROR ReferenceError: cep is not defined
```

**Outra tentativa foi:**

```
import * as cep from 'cep-promise';

cep('09665000')
.then(cep => {
console.log(cep);
});
```

Erro apresentado pelo Typescript:
```
This expression is not callable. Type 'typeof import("cep-promise")' has no call signatures.
```

Vocês saberiam como me orientar para resolver esse problema?

Muito obrigado.

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported imports in an Angular 11 TypeScript application using cep-promise, including the older 4.0.3 version and a recent version. Compare the browser and TypeScript errors, then document the supported import behavior or the package compatibility issue; done means the correct usage is confirmed and reproducible.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.