Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (18 sloc) 431 Bytes
import data from "./data.json";
type Data = {
a: string;
array: {
hoge: number;
}[];
};
const d1: Data = data;
const d2: Data = data; // type check error ocurred
const copiedData = data;
const d3: Data = copiedData; // type check error didn't occur
const data2 = {
a: "b",
c: "d",
array: [{ hoge: 1 }, { hoge: 2, foo: "bar" }]
};
const d4: Data = data2;
const d5: Data = data2; // type check error didn't occur
You can’t perform that action at this time.