microsoft / microsoft/TypeScript
[Feature request] keyword `final` type for output full final type in .d.ts
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.3k
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 132
Descripción
Search Terms
Suggestion
with keyword final, output a final type typescript know in .d.ts
Use Cases
this help when we import a.ts will didn't need import other file for get type info
Examples
b.ts
export type A2 = {
a: number,
}
export type B2 = {
b: number,
}
origin
a.ts
import { A2, B2 } from './b'
type A1 = {
a: number,
}
type B1 = {
b: number,
}
export type C1 = A1 & B1
export type C2 = A2 & B2
=>
.d.ts
import { A2, B2 } from './b';
declare type A1 = {
a: number;
};
declare type B1 = {
b: number;
};
export declare type C1 = A1 & B1;
export declare type C2 = A2 & B2;
with keyword final
a.ts
import { A2, B2 } from './b'
export type A1 = {
a: number,
}
export type B1 = {
b: number,
}
export final type C1 = A1 & B1
export final type C2 = A2 & B2
=>
will no need to know what is A1 B1
and also will not import b.ts for know what is A2, B2 when import a.ts
export declare type C1 = {
a: number,
b: number,
}
export declare type C2 = {
a: number,
b: number,
}
or
export declare type C1 = {
a: number,
} & {
b: number,
}
export declare type C2 = {
a: number,
} & {
b: number,
}
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza comparando los ejemplos a.ts y b.ts con la salida .d.ts solicitada y aclarando la semántica prevista del tipo final propuesto. En la issue no se mencionan archivos del repositorio ni tests; darlo por terminado requeriría un diseño acordado y un comportamiento correspondiente del compilador para los casos mostrados.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- compilers
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 25/100