---
# System prepended metadata

title: Fixing Null & Types Issues in Angular App
tags: [angular, ' tslint']

---

---
tags: angular, tslint
---

# Fixing Null & Types Issues in Angular App
![](https://i.imgur.com/jahpkzs.jpg)


If you see the errors like below in your Angular app and worried how to fix it Then you are in right place continue reading this article. 

`Type 'null' is not assignable to type 'Student[]'.`

`expected call-signature: 'getUrlForId' to have a typedef (typedef)tslint(1)`

## Fixing Type null Tslint Error

`Type 'null' is not assignable to type 'Student[]'.`
Lets take the first error Type null. This kind of tslint error I generally avoid by returning any type. However this seems more verbose. In order to fix it in entire application you should consider going to tsconfig.json and make `strict:false`

![](https://i.imgur.com/aNyjQpZ.png)


## Fixing expected call-signature Tslint Error

`expected call-signature: 'getUrlForId' to have a typedef (typedef)tslint(1)`

In your angular application if you see these errors which is really frustrating. 

![](https://i.imgur.com/rZzQbRA.png)


In order to fix these errors you are suppose define the return type in each of these methods. 

Like if you have method getUrl the you are marking its return type as string.
![](https://i.imgur.com/wKkkIkK.png)

However, what is the benefit of using typescript if types are not automatically derived? I agree you should define return type of each method and properties if you are writing an library and willing to share to some other project via npm package. Because, there you want them to see the return type of each api. 

However, within your application defining return type everywhere is verbose and painful so I decided to fix this by going to `tslint.json` and marking `typedev `to `false`


```json=
 "typedef": [
      false,
      "call-signature"
    ],
```

![](https://i.imgur.com/V426Rw1.png)



---


Rupesh Tiwari,
www.rupeshtiwari.com
Founder of www.fullstackmaster.net 
