prettier/tests/flow/export_type/__snapshots__/jsfmt.spec.js.snap

138 lines
3.3 KiB
Plaintext

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`cjs_with_types.js 1`] = `
/* @flow */
export type talias4 = number;
export interface IFoo { prop: number };
module.exports = {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */
export type talias4 = number;
export interface IFoo { prop: number }
module.exports = {};
`;
exports[`importer.js 1`] = `
/* @flow */
import type {
inlinedType1,
standaloneType1,
talias1,
talias3,
} from "./types_only";
var a: inlinedType1 = 42;
var b: inlinedType1 = 'asdf'; // Error: string ~> number
var c: standaloneType1 = 42;
var d: standaloneType1 = 'asdf'; // Error: string ~> number
var e: talias1 = 42;
var f: talias1 = 'asdf'; // Error: string ~> number
var g: talias3 = 42;
var h: talias3 = 'asdf'; // Error: string ~> number
import type {talias4} from "./cjs_with_types";
var i: talias4 = 42;
var j: talias4 = 'asdf'; // Error: string ~> number
import {IFoo, IFoo2} from "./types_only";
var k: IFoo = {prop: 42};
var l: IFoo = {prop: 'asdf'}; // Error: {prop:string} ~> {prop:number}
var m: IFoo2 = {prop: 'asdf'};
var n: IFoo2 = {prop: 42}; // Error: {prop:number} ~> {prop:string}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */
import type {
inlinedType1,
standaloneType1,
talias1,
talias3
} from "./types_only";
var a: inlinedType1 = 42;
var b: inlinedType1 = "asdf"; // Error: string ~> number
var c: standaloneType1 = 42;
var d: standaloneType1 = "asdf"; // Error: string ~> number
var e: talias1 = 42;
var f: talias1 = "asdf"; // Error: string ~> number
var g: talias3 = 42;
var h: talias3 = "asdf"; // Error: string ~> number
import type { talias4 } from "./cjs_with_types";
var i: talias4 = 42;
var j: talias4 = "asdf"; // Error: string ~> number
import { IFoo, IFoo2 } from "./types_only";
var k: IFoo = { prop: 42 };
var l: IFoo = { prop: "asdf" }; // Error: {prop:string} ~> {prop:number}
var m: IFoo2 = { prop: "asdf" };
var n: IFoo2 = { prop: 42 }; // Error: {prop:number} ~> {prop:string}
`;
exports[`types_only.js 1`] = `
/* @flow */
export type inlinedType1 = number;
var a: inlinedType1 = 42;
var b: inlinedType1 = 'asdf'; // Error: string ~> number
type standaloneType1 = number;
export type {standaloneType1};
type standaloneType2 = number;
export {standaloneType2}; // Error: Missing \`type\` keyword
export type {talias1, talias2 as talias3, IFoo2} from "./types_only2";
export interface IFoo { prop: number };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */
export type inlinedType1 = number;
var a: inlinedType1 = 42;
var b: inlinedType1 = "asdf"; // Error: string ~> number
type standaloneType1 = number;
export type { standaloneType1 };
type standaloneType2 = number;
export { standaloneType2 }; // Error: Missing \`type\` keyword
export type { talias1, talias2 as talias3, IFoo2 } from "./types_only2";
export interface IFoo { prop: number }
`;
exports[`types_only2.js 1`] = `
/* @flow */
export type talias1 = number;
export type talias2 = number;
export interface IFoo2 { prop: string };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */
export type talias1 = number;
export type talias2 = number;
export interface IFoo2 { prop: string }
`;