mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 11:07:32 +08:00
[ember] refactor @ember/string types into their own package (#28791)
* [@types/ember__string] refactor types out of @types/ember, add additional tests * [@ember/string] enable all TSLint rules
This commit is contained in:
committed by
Ryan Cavanaugh
parent
c43bcd9fd7
commit
614492e26b
33
types/ember__string/ember__string-tests.ts
Normal file
33
types/ember__string/ember__string-tests.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w } from '@ember/string';
|
||||
|
||||
dasherize(); // $ExpectError
|
||||
dasherize('blue man group'); // $ExpectType string
|
||||
dasherize('', ''); // $ExpectError
|
||||
|
||||
camelize(); // $ExpectError
|
||||
camelize('blue man group'); // $ExpectType string
|
||||
camelize('', ''); // $ExpectError
|
||||
|
||||
decamelize(); // $ExpectError
|
||||
decamelize('blue man group'); // $ExpectType string
|
||||
decamelize('', ''); // $ExpectError
|
||||
|
||||
underscore(); // $ExpectError
|
||||
underscore('blue man group'); // $ExpectType string
|
||||
underscore('', ''); // $ExpectError
|
||||
|
||||
w(); // $ExpectError
|
||||
w('blue man group'); // $ExpectType string[]
|
||||
w('', ''); // $ExpectError
|
||||
|
||||
classify(); // $ExpectError
|
||||
classify('blue man group'); // $ExpectType string
|
||||
classify('', ''); // $ExpectError
|
||||
|
||||
capitalize(); // $ExpectError
|
||||
capitalize('blue man group'); // $ExpectType string
|
||||
capitalize('', ''); // $ExpectError
|
||||
|
||||
loc(); // $ExpectError
|
||||
loc("_Hello World"); // $ExpectType string
|
||||
loc("_Hello %@ %@", ["John", "Smith"]); // $ExpectType string
|
||||
18
types/ember__string/index.d.ts
vendored
Normal file
18
types/ember__string/index.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Type definitions for @ember/string 3.0
|
||||
// Project: http://emberjs.com/
|
||||
// Definitions by: Mike North <https://github.com/mike-north>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export const camelize: typeof Ember.String.camelize;
|
||||
export const capitalize: typeof Ember.String.capitalize;
|
||||
export const classify: typeof Ember.String.classify;
|
||||
export const dasherize: typeof Ember.String.dasherize;
|
||||
export const decamelize: typeof Ember.String.decamelize;
|
||||
export const htmlSafe: typeof Ember.String.htmlSafe;
|
||||
export const isHTMLSafe: typeof Ember.String.isHTMLSafe;
|
||||
export const loc: typeof Ember.String.loc;
|
||||
export const underscore: typeof Ember.String.underscore;
|
||||
export const w: typeof Ember.String.w;
|
||||
28
types/ember__string/tsconfig.json
Normal file
28
types/ember__string/tsconfig.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"@ember/string": ["ember__string"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ember__string-tests.ts"
|
||||
]
|
||||
}
|
||||
4
types/ember__string/tslint.json
Normal file
4
types/ember__string/tslint.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {}
|
||||
}
|
||||
Reference in New Issue
Block a user