类型定义的目的是什么? 什么时候有用?

In golang you can define a type as a data structure

type MyMap map[int]int
mapper := make(MyMap)

and go on to use it like a regular map in go

mapper[13] = 133

But I don't understand when to use this or in what scenarios this will helpful?

That is not a type alias (as the OP originally asked, before the question was edited).
That is a type definition or "defined type".

A type definition creates a new, distinct type with the same underlying type and operations as the given type, and binds an identifier to it.

TypeDef = identifier Type .

That allows you to attach method on that type that you would not have been able to with the original type.


Type alias is part of the Go 1.9 changes.
It was proposed here and documented in Code refactoring.

Go should add the ability to create alternate equivalent names for types, in order to enable gradual code repair during codebase refactoring.

It is helpful when you wants to redeclare different parameters which are going to be map[int]int. Just when serving post request they use url.Values{} which is actually a map[string][]string.

package main

import (
    "fmt"
    "net/url"
)

func main() {
    v := url.Values{}
    v.Set("name", "Ava")
    v.Add("friend", "Jess")
    v.Add("friend", "Sarah")
    v.Add("friend", "Zoe")
    // v.Encode() == "name=Ava&friend=Jess&friend=Sarah&friend=Zoe"
    fmt.Println(v.Get("name"))
    fmt.Println(v.Get("friend"))
    fmt.Println(v["friend"])
}