Deno 1.2.0: Url Argument Type Solutions
Tags: deno, typescript, javascript, ogone
Published: 2020-07-14 13:32:07

## Intro
hmm, yesterday, some of us, Deno Devs (or Denosaurs or...) had a really rude experience with `deno upgrade`.
Like each time there's a new version we naturally decided to switch and upgrade to the new version.
I think this is a really good lesson for me and perhaps others. you're gonna see why.
**Deno 1.2.0** came with a "breaking" change or I don't know how to call it, that slowed down many modules development, like Mandarine.ts from Andres Pirela or Ogone for myself.
this version implements a new **Argument type** for **URL**, it says:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/x8rgr7jdbd0thw9xxqa3.png)
> TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.

The main problem is ... this is not my code... so something were broken but I didn't know where.
after a discussion in discord, we saw that **std/path** version **under 0.61.0 is broken** (in my case) on **Deno 1.2.0**. 

## Fix
So, the first thing I did: **upgrade the std/path** in `deps.ts` to 0.61.0 (if you got one in your module, or in `mod.ts`). after this, the same issue came out: new Url(bruh) is not assignable .. that was not enough and I had to learn how to inspect the dependency tree by using: `deno info --unstable --no-check deps.ts`

> `--no-check` will say to the **typescript compiler** to omit the errors. and `--unstable` is to allow the unstable features of **Deno**.

this should print a large list like following:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/e5mmib9o1wjxlpttdvoc.png)

for me that was [plugin_prepare](https://github.com/manyuanrong/deno-plugin-prepare/pull/17), used by **Deno Sass** that were using an old version of **std/path** (0.51.0). after a Pull Request this were fixed.

## Solutions
- **Avoid using master branch**: you guys need to put the version on the imports, especially for the deno.x modules. master's branch is by definition unstable. do `deno.land/std@[version]/[module]/...`. do it now for all your dependencies

- **Deno info**: use `deno info --unstable --no-check deps.ts` like explained above to inspect which module is using an old deno.std version.

- **Pull Request**: if you're in the same case with a dependent sub-module, you need to make a PR or ping the maintainers and tell them to use supported version of deno.std in **Deno 1.2.0**

- **Downgrade**: `deno upgrade --version 1.1.3` and wait for all the sub-modules to change the versions.

- **the sub-module is no more maintained**: erase it.
- **also**: keep in  mind deno.std are still unstable.

## Acknowledgements
- @Yamboy
- @lucasonato

## related sources:
- [The issue](https://github.com/denoland/deno/issues/5365#issuecomment-658087635)

## See also:
- [Nest.land](https://nest.land/) package registry for Deno with immutable packages using Blockchain
- [Deno Sass](https://github.com/divy-work/deno-sass) module binding Sass CSS Pre-Processor for Deno
- [Ogone](https://github.com/SRNV/Ogone) Web Components-Compiler, Client Side Rendering for Deno.
- [Mandarine.ts](https://github.com/mandarineorg/mandarinets) is a framework that allows you to create applications.