How can I enter a default export using a stream? Is there any way to complete this process?
Desired Result:
// index.js
type complexThing = {
a: string
}
type Thing = {
x: number,
y: boolean,
z: complexThing
}
export default {
x: 0,
y: true,
z: {a: 'hello'}
} : Thing // this says my default export is a Thing
Valid Alternative:
As an alternative, I would not mind writing each of the properties of an object into a string, but I think it is syntactically impossible:
export default {
x: 0,
y: true,
z: {a: 'hello'}
}
Not what I want:
What I do not want to do is save the variable just so that the stream type:
// index.js
type complexThing = {
a: string
}
type Thing = {
x: number,
y: boolean,
z: complexThing
}
const myThing: Thing = {
x: 0,
y: true,
z: {a: 'hello'}
}
export default myThing
source
share