mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[@ember/object] remove all 'import ember' from tests (#29761)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import Ember from 'ember';
|
||||
import { assertType } from './lib/assert';
|
||||
import CoreObject from '@ember/object/core';
|
||||
|
||||
/** Newable tests */
|
||||
const co1 = new Ember.CoreObject();
|
||||
const co1 = new CoreObject();
|
||||
|
||||
// TODO: Enable in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
// co1.concatenatedProperties; // $ExpectType string[]
|
||||
@@ -12,7 +12,7 @@ co1.destroy(); // $ExpectType CoreObject
|
||||
co1.toString(); // $ExpectType string
|
||||
|
||||
/** .create tests */
|
||||
const co2 = Ember.CoreObject.create();
|
||||
const co2 = CoreObject.create();
|
||||
// TODO: Enable in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
// co2.concatenatedProperties; // $ExpectType string[]
|
||||
co2.isDestroyed; // $ExpectType boolean
|
||||
@@ -21,13 +21,13 @@ co2.destroy(); // $ExpectType CoreObject
|
||||
co2.toString(); // $ExpectType string
|
||||
|
||||
/** .create tests w/ initial instance data passed in */
|
||||
const co3 = Ember.CoreObject.create({ foo: '123', bar: 456 });
|
||||
const co3 = CoreObject.create({ foo: '123', bar: 456 });
|
||||
|
||||
co3.foo; // $ExpectType string
|
||||
co3.bar; // $ExpectType number
|
||||
|
||||
/** .extend with a zero-argument .create() */
|
||||
const co4 = Ember.CoreObject.extend({
|
||||
const co4 = CoreObject.extend({
|
||||
foo: '123',
|
||||
bar: 456,
|
||||
baz(): [string, number] {
|
||||
@@ -40,8 +40,8 @@ co4.bar; // $ExpectType number
|
||||
co4.baz; // $ExpectType () => [string, number]
|
||||
|
||||
/** .extend with inconsistent arguments passed into .create() */
|
||||
const class05 = Ember.CoreObject.extend({
|
||||
foo: '123' as (string | boolean),
|
||||
const class05 = CoreObject.extend({
|
||||
foo: '123' as string | boolean,
|
||||
bar: 456,
|
||||
baz() {
|
||||
return [this.foo, this.bar];
|
||||
@@ -54,33 +54,36 @@ assertType<string>(c05b.foo); // $ExpectError
|
||||
assertType<boolean>(c05c.foo); // $ExpectError
|
||||
|
||||
/** two .extend arguments with a zero-argument .create() */
|
||||
const co6 = Ember.CoreObject.extend({
|
||||
foo: '123',
|
||||
bar: 456,
|
||||
baz() {
|
||||
return [this.foo, this.bar];
|
||||
const co6 = CoreObject.extend(
|
||||
{
|
||||
foo: '123',
|
||||
bar: 456,
|
||||
baz() {
|
||||
return [this.foo, this.bar];
|
||||
},
|
||||
func1() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.foo; // $ExpectType string
|
||||
// this does not include stuff from later extend args
|
||||
this.bee; // $ExpectError
|
||||
}
|
||||
},
|
||||
func1() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.foo; // $ExpectType string
|
||||
// this does not include stuff from later extend args
|
||||
this.bee; // $ExpectError
|
||||
{
|
||||
foo: 99,
|
||||
bee: 'honey',
|
||||
func2() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
this.foo; // $ExpectType string & number
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bar; // $ExpectType number
|
||||
}
|
||||
}
|
||||
}, {
|
||||
foo: 99,
|
||||
bee: 'honey',
|
||||
func2() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
this.foo; // $ExpectType string & number
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bar; // $ExpectType number
|
||||
}
|
||||
}).create();
|
||||
).create();
|
||||
|
||||
// TODO: enable in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
// assertType<string>(co6.foo); // $ExpectError
|
||||
@@ -88,45 +91,49 @@ assertType<number>(co6.bar); // $ExpectType number
|
||||
assertType<() => Array<string | number>>(co6.baz); // $ExpectType () => (string | number)[]
|
||||
|
||||
/** three .extend arguments with a zero-argument .create() */
|
||||
const co7 = Ember.CoreObject.extend({
|
||||
foo: '123',
|
||||
bar: 456,
|
||||
baz() {
|
||||
return [this.foo, this.bar];
|
||||
const co7 = CoreObject.extend(
|
||||
{
|
||||
foo: '123',
|
||||
bar: 456,
|
||||
baz() {
|
||||
return [this.foo, this.bar];
|
||||
},
|
||||
func1() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.foo; // $ExpectType string
|
||||
// this does not include stuff from later extend args
|
||||
this.bee; // $ExpectError
|
||||
}
|
||||
},
|
||||
func1() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.foo; // $ExpectType string
|
||||
// this does not include stuff from later extend args
|
||||
this.bee; // $ExpectError
|
||||
{
|
||||
foo: 99,
|
||||
bee: 'honey',
|
||||
func2() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
this.foo; // $ExpectType string & number
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bar; // $ExpectType number
|
||||
}
|
||||
},
|
||||
{
|
||||
foo: '99',
|
||||
money: 'in the banana stand',
|
||||
func3() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.money; // $ExpectType string
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bee; // $ExpectType string
|
||||
this.bar; // $ExpectType number
|
||||
}
|
||||
}
|
||||
}, {
|
||||
foo: 99,
|
||||
bee: 'honey',
|
||||
func2() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
this.foo; // $ExpectType string & number
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bar; // $ExpectType number
|
||||
}
|
||||
}, {
|
||||
foo: '99',
|
||||
money: 'in the banana stand',
|
||||
func3() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.money; // $ExpectType string
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bee; // $ExpectType string
|
||||
this.bar; // $ExpectType number
|
||||
}
|
||||
}).create();
|
||||
).create();
|
||||
// TODO: enable in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
// assertType<number>(co7.foo); // $ExpectError
|
||||
assertType<number>(co7.bar); // $ExpectType number
|
||||
@@ -134,62 +141,67 @@ assertType<string>(co7.money); // $ExpectType string
|
||||
assertType<() => Array<string | number>>(co7.baz); // $ExpectType () => (string | number)[]
|
||||
|
||||
/** four .extend arguments with a zero-argument .create() */
|
||||
const co8 = Ember.CoreObject.extend({
|
||||
foo: '123',
|
||||
bar: 456,
|
||||
baz() {
|
||||
return [this.foo, this.bar];
|
||||
const co8 = CoreObject.extend(
|
||||
{
|
||||
foo: '123',
|
||||
bar: 456,
|
||||
baz() {
|
||||
return [this.foo, this.bar];
|
||||
},
|
||||
func1() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.foo; // $ExpectType string
|
||||
// this does not include stuff from later extend args
|
||||
this.bee; // $ExpectError
|
||||
}
|
||||
},
|
||||
func1() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.foo; // $ExpectType string
|
||||
// this does not include stuff from later extend args
|
||||
this.bee; // $ExpectError
|
||||
{
|
||||
foo: 99,
|
||||
bee: 'honey',
|
||||
func2() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
this.foo; // $ExpectType string & number
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bar; // $ExpectType number
|
||||
// this does not include stuff from later extend args
|
||||
this.money; // $ExpectError
|
||||
}
|
||||
},
|
||||
{
|
||||
foo: '99',
|
||||
money: 'in the banana stand',
|
||||
func3() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.money; // $ExpectType string
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bee; // $ExpectType string
|
||||
this.bar; // $ExpectType number
|
||||
// this does not include stuff from later extend args
|
||||
this.neighborhood; // $ExpectError
|
||||
}
|
||||
},
|
||||
{
|
||||
foo: '99',
|
||||
neighborhood: 'sudden valley',
|
||||
func4() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.neighborhood; // $ExpectType string
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bee; // $ExpectType string
|
||||
this.bar; // $ExpectType number
|
||||
this.money; // $ExpectType string
|
||||
}
|
||||
}
|
||||
}, {
|
||||
foo: 99,
|
||||
bee: 'honey',
|
||||
func2() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
this.foo; // $ExpectType string & number
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bar; // $ExpectType number
|
||||
// this does not include stuff from later extend args
|
||||
this.money; // $ExpectError
|
||||
}
|
||||
}, {
|
||||
foo: '99',
|
||||
money: 'in the banana stand',
|
||||
func3() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.money; // $ExpectType string
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bee; // $ExpectType string
|
||||
this.bar; // $ExpectType number
|
||||
// this does not include stuff from later extend args
|
||||
this.neighborhood; // $ExpectError
|
||||
}
|
||||
}, {
|
||||
foo: '99',
|
||||
neighborhood: 'sudden valley',
|
||||
func4() {
|
||||
// this includes stuff from CoreObject
|
||||
this.init; // $ExpectType () => void
|
||||
// this includes stuff from this extend-arg
|
||||
this.neighborhood; // $ExpectType string
|
||||
// this includes stuff from earlier extend-args
|
||||
this.bee; // $ExpectType string
|
||||
this.bar; // $ExpectType number
|
||||
this.money; // $ExpectType string
|
||||
}
|
||||
}).create();
|
||||
).create();
|
||||
|
||||
// TODO: enable in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
// assertType<number>(co8.foo); // $ExpectError
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { assertType } from './lib/assert';
|
||||
import Ember from 'ember';
|
||||
import { PersonWithNumberName, Person } from './create';
|
||||
|
||||
Person.create({ firstName: 99 }); // $ExpectError
|
||||
|
||||
Reference in New Issue
Block a user